3

我正在尝试运行以下命令(在 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

如果有帮助,我们正在使用自托管 Git 服务器,使用 Bonobo Git 服务器。

根据下面的一些评论,我尝试使用一些额外的跟踪重新运行命令。在 when--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 的工具来部署一些代码,而它的 GoCD 是发出 GIT 命令的,立即挂起。(我认为我无法控制它发出的克隆 GIT 存储库的命令)。当我在我的机器上本地运行命令时会发生同样的事情,所以它实际上不是 GoCD 的问题。

4

0 回答 0