- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
一些 Git 服务器或托管服务(显然是 GitHub Enterprise)不支持浅克隆,相反,它们会在发送如下请求时停止:
git clone --depth 1 https://server/user/repo.git
有没有办法检测服务器是否支持浅克隆?是否可以向服务器发送 Git 或 CURL 命令以查明它是否支持浅克隆?
我找到了对 Git Protocol Capabilities 的引用,这是我需要寻找的吗?我怎样才能掌握服务器的能力?
最佳答案
ssh -x git@server "git-receive-pack 'simplegit-progit.git'"
005bca82a6dff817ec66f4437202690a93763949 refs/heads/master report-status \
delete-refs side-band-64k quiet ofs-delta \
agent=git/2:2.1.1+github-607-gfba4028 delete-refs
The git-receive-pack command immediately responds with one line for each reference it currently has – in this case, just the master branch and its SHA-1.
The first line also has a list of the server’s capabilities (here, report-status, delete-refs, and some others, including the client identifier).
git 远程助手有 options related to the shallow capability ,但不清楚它们是否会以与上述 ssh 命令相同的方式被公布。
git 1.6.6更新了包文件传输协议(protocol),包括“Reference Discovery”部分:
When the client initially connects the server will immediately respond with a listing of each reference it has (all branches and tags) along with the object name that each reference currently points to.
$ echo -e -n "0039git-upload-pack /schacon/gitbook.git\0host=example.com\0" |
nc -v example.com 9418
00887217a7c7e582c46cec22a130adf4b9d7d950fba0 HEAD\0multi_ack thin-pack
side-band side-band-64k ofs-delta shallow no-progress include-tag
00441d3fcd5ced445d1abc402225c0b8a1299641f497 refs/heads/integration
003f7217a7c7e582c46cec22a130adf4b9d7d950fba0 refs/heads/master
003cb88d2441cac0977faf98efc80305012112238d9d refs/tags/v0.9
003c525128480b96c89e6418b1e40909bf6c5b2d580f refs/tags/v1.0
003fe92df48743b7bc7d26bcaabfddde0a1e20cae47c refs/tags/v1.0^{}
0000
如今(Git 2.23,2019 年第三季度,4 年后),git fetch -v -v
足以显示任何支持的功能。
参见 commit 0e04297 , commit 5a88583 , commit 0778b29 (2019 年 6 月 20 日)作者 Nguyễn Thái Ngọc Duy (pclouds
) .
(由 Junio C Hamano -- gitster
-- merge 于 commit b49d337 ,2019 年 7 月 9 日)
fetch-pack
: print server version at the top in-v -v
Before the previous patch, the server version is printed after all the "
Server supports
" lines.
The previous one puts the version in the middle of "Server supports" group.Instead of moving it to the bottom, I move it to the top.
Version may stand out more at the top as we will have even more debug out after capabilities.
fetch-pack
: print all relevant supported capabilities with-v -v
When we check if some capability is supported, we do print something in verbose mode.
Some capabilities are not printed though (and it made me think it's not supported; I was more used toGIT_TRACE_PACKET
) so let's print them all.It's a bit more code. And one could argue for printing all supported capabilities the server sends us. But I think it's still valuable this way because we see the capabilities that the client cares about.
关于git - 如何检测Git服务器是否支持浅克隆?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29406027/
免责声明 这篇文章是关于术语“浅拷贝”和“深拷贝”的正确用法,特别是在谈论复制一个不包含任何引用的对象时。这个问题并不意味着(也不应该)基于意见,除非真的没有关于这个话题的共识。我已将此问题标记为 C
我有这个功能 int getrelation(string name, RELATION& output){ bool found=0; int index=0;
与 why should I make a copy of a data frame in pandas 有关 我注意到在流行的backtesting图书馆, def __init__(self, d
我的问题很基础,但我想 100% 理解所有内容。 SO中的很多问题都引用了我的帖子,但我没有找到满意的答案。 我们知道java中的枚举是引用类型。让我们考虑以下片段: public static cl
请引用这个 fiddle 的问题。 http://jsfiddle.net/AQR55/ 1)为什么附加到隔离范围属性的 watch - 双向绑定(bind)到父属性,不会在更改父范围属性时触发。 在
我想使用 UP3 来完成一项非常具体的任务,我应该能够使用 API 来实现该任务。我想了解是否可以编写以下应用程序。 基于https://jawbone.com/support/articles/00
如何在辅助方法中传递上下文并提取数据? 请参阅以下代码片段: import AppContext from '../../context/AppContext' import extractDatta
我正在尝试使用 simple-git 创建浅克隆。我正在尝试创建与此命令等效的命令:git clone --depth 1 https://github.com/steveukx/git-js.git
我是一名优秀的程序员,十分优秀!