3

I am trying to run the following command (in a Windows command prompt) to clone a git repository

git clone --branch=master --no-checkout --depth=2 --progress -v http://mygitserver.com/myrepo.git C:\Dev

However, the progress shows it only gets as far as the following command, then it just hangs:

POST git-upload-pack (165 bytes)

The task does not end, it just waits indefinitely, and no progress is made.

However, if I remove the --depth parameter, then the command completes as expected. I've tried the command on a different repository and branch, but the same hanging occurs.

Does anyone have any suggestion as to why the git clone command is failing when --depth is specified?

If it helps, we are using a self-hosted Git server, using Bonobo Git Server.

Following on from some comments below, I tried re-running the commands with some extra traces. In the case when --depth=2 is set, the following is return for the final HTTP command...

> 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
<

At this point, it just hangs.

When I re-run the command without --depth=2 specified, it gets further, and completes

> 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.

Note that I am actually using a tool called GoCD to deploy some code, and it GoCD that is issuing the GIT command, the promptly hanging. (I don't think I have any control over what command it issues to clone the GIT repo). The same thing happens when I run the command locally on my machine, so it is not actually an issue with GoCD though.

Tim C
  • 70,053
  • 14
  • 74
  • 93
  • Does the issue persists with a git-for-windows 2.9.0? (https://github.com/git-for-windows/git/releases/tag/v2.9.0.windows.1) (https://github.com/git-for-windows/git/releases/download/v2.9.0.windows.1/PortableGit-2.9.0-64-bit.7z.exe) – VonC Jun 17 '16 at 15:37
  • I have just updated git for windows to 2.9.0 but sadly the issue still occurs. – Tim C Jun 17 '16 at 15:48
  • 1
    Can you set `GIT_TRACE=1` `GIT_CURL_VERBOSE=1`, and see if there is any clue when cloning `--depth=2`? (https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables) – VonC Jun 17 '16 at 15:49
  • The last http command showing being sent to the server is `POST /myrepo.git/git-upload-pack HTTP/1.1`, and this comes back with `upload completely sent off: 165 out of 165 bytes` and `< HTTP/1.1 200 OK`, along with the other headers, but then nothing. With `--depth=2` removed, I get back `upload completely sent off: 200 out of 200 bytes` and the same headers, but after the headers it says `remote: Counting objects: 442, done....`. Note that in both cases, the hidden `.git` folder is created. – Tim C Jun 17 '16 at 16:29
  • No clue for now: you can edit your question to include those information, for others to look into. – VonC Jun 17 '16 at 18:16
  • After some investigation this may be an issue with the version of Bonobo GIT server we are using. The version we are using is 2 years old, and looking in the change logs of later version there is a mention of a bug being fixed with regards the git clone command. – Tim C Jun 30 '16 at 07:41
  • That is a good clue: upgrading the server side (at least setting up a test server with an up-to-date version) is a good idea. – VonC Jun 30 '16 at 07:43
  • Possible duplicate of [Why would git-upload-pack (during git clone) hang?](https://stackoverflow.com/questions/17072484/why-would-git-upload-pack-during-git-clone-hang) – Paul Sweatte Jul 25 '17 at 17:21

0 Answers0