找出远程服务器上的git版本 [英] Finding out the version of git on remote server

查看:150
本文介绍了找出远程服务器上的git版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找我的本地机器上的git命令,我可以运行它来查找在远程服务器上运行的git版本?
如果这是可能的话。

解决方案

现代git服务器(开始于 GIT中1.7.12.1 )将返回它们的版本信息中的功能协商中的协议。虽然没有git命令可以在本地运行,但您可以简单地向git服务器查询信息,最近的版本将提供版本号。



您可以使用Web客户端来请求:

 < repository url> / info / refs?service = git-upload-pack 

然后检查 agent的第一行= 举例来说,对于CodePlex:

 %curl https 

://git01.codeplex.com/gittf/info/refs\服务= GIT中的上载包
000000bd43569b9f6f29136b6544809eacd2417a308f9341 HEAD\0multi_ack薄包
侧带侧带-64K OFS- delta浅进程include-tag multi_ack_detailed
没有完成代理= git / 1.8.4.msysgit.0

这表明CodePlex在Windows 1.8.4中使用Git( git / 1.8.4.msysgit.0 )。



或者针对GitHub:

 %curl http S://github.com/libgit2/libgit2.git/info/refs\服务=混帐上传包
000000f83f8d005a82b39c504220d65b6a6aa696c3b1a9c4 HEAD\0multi_ack
薄包边带边频带 - 64K OFS-Δ浅无进展包括标签
multi_ack_detailed无完成symref = HEAD:参/头/主
剂= GIT中/ 2:2.1.1〜peff-裸reflogs-fetch-删除了616-gc016f98
... ref信息...

表明GitHub正在使用一个定制的git版本: git / 2:2.1.1〜peff-bare-reflogs-fetch-616-gc016f98


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.

解决方案

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.

这篇关于找出远程服务器上的git版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆