More can be written, and there are a number of previous discussions here. I think best overall is "How secret were the secret alliances prior to WWI?" by [deleted] (user elos_, now unfortunately gone from the subreddit).
"After centuries of rivalry and dislike towards each other, what eventually leads to Great Britain and France into becoming allies?" by /u/Kugelfang52 emphasizes Germany more.
This is not to discourage discussion. I'd love to see a nice comprehensive reply that at least mentions by name the Greek War of Independence, the Crimean War, Fashoda, and the Moroccan Crises with the Kaiser. More questions, data, and debate are welcome.