Git push hangs for a large repository

2019-04-10 11:24发布

I'm trying to resolve this for the last couple of days.

First of all I'm working behind a proxy, I've setup a connection using Cntlm and I've tried creating a small repository on my Visual Studio Online account and everything works as expected, I'm able to clone and push.

I've created another repository, this time bigger (the whole repo is about 800MB) and when I tried to push. It takes me through the authentication cycle and then it just hangs (I've left it hanging for 24 hours and nothing happens). I've increased git's postBuffer to 524288000 as suggested elsewhere, but that didn't help.

Further more I've set

GIT_CURL_VERBOSE=1

Then when I run:

git push origin master -v

This is where it gets stuck:

> POST /DefaultCollection/_git/PROJex/git-receive-pack HTTP/1.1
Authorization: Basic ZGRpbWl0cm92OkQxbxxxxxx               
User-Agent: git/1.9.2.msysgit.0                             
Host: [user].visualstudio.com                         
Accept-Encoding: gzip                                       
Content-Type: application/x-git-receive-pack-request        
Accept: application/x-git-receive-pack-result               
Content-Length: 37423253      

* Connection #1 to host localhost left intact   

I see that the content length is significantly larger than with the small repo. I should also note that there is a 500+ commit log.

Now I thought it might be a proxy issue, so I tried it without a proxy on a different network and I got the same results. Anything other than http(s) is not an option in my setup.

1条回答
Anthone
2楼-- · 2019-04-10 12:16

If pushing a all big repo isn't an option (for any reason), then you could consider transferring a bundle of that same repo on the server, and fetching (on the server) from that bundle. That is, if you have access to the server.

The transfer is made easier by the fact a git bundle only generates one file.


The other alternative (if you don't have access to the server) is to split your push into several smaller one:

A<-B<-C<-D<-E

You can try:

git push origin B:master
git push origin D:master
git push origin master

Each time, that would push all commits, up to the one you reference.
At the end, the last push would be an incremental one, much smaller than pushing everything.

查看更多
登录 后发表回答