我正在尝试运行以下命令(在Windows命令提示符下)来克隆git存储库
git clone --branch=master --no-checkout --depth=2 --progress -v http://mygitserver.com/myrepo.git C:\Dev
然而,进度显示它只能达到以下命令,然后它就会挂起:
POST git-upload-pack (165 bytes)
任务没有结束,它只是无限期地等待,并且没有取得任何进展。
但是,如果我删除--depth
参数,则命令按预期完成。我已经在不同的存储库和分支上尝试了该命令,但同样的挂起发生了。
在指定git clone
时,是否有人建议--depth
命令失败的原因?
如果有帮助,我们使用Bonobo Git Server使用自托管Git服务器。
继下面的一些评论之后,我尝试使用一些额外的跟踪重新运行命令。在设置--depth=2
的情况下,将返回以下最终HTTP命令...
> POST /MyRepo.git/git-upload-pack HTTP/1.1
Host: mygitserver.com
Authorization: Basic xxxxxxxxxxxxxxxxxxxx
User-Agent: git/2.9.0.windows.1
Accept-Encoding: gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 165
* upload completely sent off: 165 out of 165 bytes
< HTTP/1.1 200 OK
< Cache-Control: no-cache, max-age=0, must-revalidate
< Pragma: no-cache
< Transfer-Encoding: chunked
< Content-Type: application/x-git-upload-pack-result
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Server: Microsoft-IIS/7.5
< X-AspNetMvc-Version: 4.0
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Sat, 18 Jun 2016 14:11:01 GMT
<
此时,它只是挂起。
当我重新运行未指定--depth=2
的命令时,它会更进一步,并完成
> POST /MyRepo.git/git-upload-pack HTTP/1.1
Host: mygitserver.com
Authorization: Basic xxxxxxxxxxxxxxxxxxxx
User-Agent: git/2.9.0.windows.1
Accept-Encoding: gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 200
* upload completely sent off: 200 out of 200 bytes
< HTTP/1.1 200 OK
< Cache-Control: no-cache, max-age=0, must-revalidate
< Pragma: no-cache
< Transfer-Encoding: chunked
< Content-Type: application/x-git-upload-pack-result
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Server: Microsoft-IIS/7.5
< X-AspNetMvc-Version: 4.0
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Sat, 18 Jun 2016 14:15:28 GMT
<
remote: Counting objects: 442, done.
remote: Compressing objects: 100% (440/440), done.
15:15:32.096147 run-command.c:336 trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 5180 on MyLaptop' '--check-self-contained-and-connected' '--pack_header=2,442'
15:15:32.158649 git.c:350 trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 5180 on MyLaptop' '--check-self-contained-and-connected' '--pack_header=2,442'
* Connection #1 to host mygitserver.com left intact
remote: Total 442 (delta 321), reused 0 (delta 0)
Receiving objects: 100% (442/442), 6.08 MiB | 431.00 KiB/s, done.
Resolving deltas: 100% (321/321), done.
Checking connectivity... 15:15:49.340288 run-command.c:336 trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all'
15:15:49.434038 git.c:350 trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all'
done.
请注意,我实际上正在使用一个名为GoCD的工具来部署一些代码,并且它正在发出GIT命令的GoCD,即时挂起。 (我不认为我可以控制克隆GIT仓库所发出的命令)。当我在我的机器上本地运行命令时会发生同样的事情,所以它实际上并不是GoCD的问题。