I am looking for the git command on my local machine which i can run to find out the version of git running on the remote server? If this is even possible.
You can check your current version of Git by running the git --version command in a terminal (Linux, macOS) or command prompt (Windows).
You can view that origin with the command git remote -v, which will list the URL of the remote repo.
The command to check which version of Git you're using is the same on both Windows and Mac. To check your Git version, open Command Prompt (Windows), Terminal (Mac), or the Linux terminal. Once open, run this command: git --version. The Git version you're currently using will be returned.
The remote name is a short-hand label for a remote repository. "origin" is the conventional default name for the first remote and is usually where you push to when you don't specify a remote for git. You can set up more than one remote for your local repo and you use the remote name when pushing to them.
Modern git servers (beginning in git 1.7.12.1) will return their version information in the capabilities negotiation in the protocol. While it's accurate that there's no git command that you can run locally, you can simply query the git server for the information and a recent version will provide the version number.
You can use a web client to request:
<repository url>/info/refs?service=git-upload-pack
And examine the first line for the agent=
report.
For example, against CodePlex:
% curl https://git01.codeplex.com/gittf/info/refs\?service=git-upload-pack 000000bd43569b9f6f29136b6544809eacd2417a308f9341 HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed no-done agent=git/1.8.4.msysgit.0
Which indicates that CodePlex is using Git for Windows 1.8.4 (git/1.8.4.msysgit.0
).
Or against GitHub:
% curl https://github.com/libgit2/libgit2.git/info/refs\?service=git-upload-pack 000000f83f8d005a82b39c504220d65b6a6aa696c3b1a9c4 HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master agent=git/2:2.1.1~peff-bare-reflogs-fetch-616-gc016f98 ... ref information removed ...
Indicating that GitHub is using a custom git version: git/2:2.1.1~peff-bare-reflogs-fetch-616-gc016f98
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With