Reputation: 365
Is there a generic way of obtaining the git version string if I have no shell access on the server?
I work in an environment where I have to validate all software I work with. If I keep using 1.9.4 for years then at some point in the future, is there a possibility that git-receive-pack or some such program introduces a breaking change? ie. my local git version stops working one fine day.. To prevent this from happening, I would like to know immediately when something has been updated on the server.
Upvotes: 3
Views: 719
Reputation: 487883
The short answer is "no": if you don't control (or have sufficient access to) the server, you can't keep them from making a breaking change. This would be true even if you could ask them about their version. We just posited that you don't control the server, so if there were a way to query the server as to the version there, they could simply lie.
That said, at least so far, all changes to git protocol handling have been done in such a way that older versions of git can talk to newer ones, and vice versa, within reason (see below). Moreover, while you can't get a specific git version, you can intuit something about the server from the protocol support flags.
See this Git Pro book section, which includes the following:
0088ca82a6dff817ec66f44342007202690a93763949 HEAD\0multi_ack thin-pack \ side-band side-band-64k ofs-delta shallow no-progress include-tag
Those blank-separated strings (multi_ack
, thin-pack
, and so on) identify what options are available. If, for instance, shallow
did not appear, you could tell that the server version predated git 1.5.0. This would mean that if you had a shallow clone (or wanted to make one) because you have a newer git, you would be unable to communicate with the server—but you would know why, as your git would say "Server does not support shallow clients".
Upvotes: 1