"We have no eternal allies, and we have no perpetual enemies. Our interests are eternal and perpetual." - Lord Palmerston, future Prime Minister of the United Kingdom, 1848.
A similar quote is attributed to Henry Kissinger, sometimes condensed to "America has no friends, only interests".
Alliances shift over time, sometimes very quickly - look at the history of the Soviet Union in WWII for an example, or Finland's response to that. But information about sources and methods can't be recalled when alliances change.
Even when alliances exist, they rarely represent a perfect alignment of interests. While Eurasia and Eastasia are allied against Oceania, they both want Oceania defeated - but each of them would rather the other footed as much of the bill as possible. Eurasia might want to understate its capabilities to its ally, in hope that it won't be asked to contribute as much; alternately, it might overstate its capabilities and loyalty to the alliance, with the goal of encouraging Eastasia to value it and not look for different partners elsewhere. So they still have reason to withhold information from one another.
Countries may even be simultaneously allies in one arena and rivals in another. The same intelligence sources and methods that collect military information beneficial to both countries in an alliance might also be conducting economic/industrial espionage harmful to the interests of one of those countries. (See the Australia/East Timor bugging scandal for a recent example of this kind of conflict.)
All of these are reasons why countries may be cagey about sharing sources and methods even with their allies, even before getting to the obvious point that the more people who know a thing the easier it is for it to leak to the current enemy.