Thursday, December 20, 2012

git hangs after "Resolving deltas"

Have had a funy problem with Git. I suppose it's proxy-related. Writing it down, because sure that will have the same problem some time again. Also hope it will help to people who are also suffering with it.

As a precondition, I have a git with following in '.gitconfig':

[http]
proxy=http://user:password@proxy:8080

When I tried to clone repository I've got this:

$ git clone https://code.google.com/p/caliper/
Cloning into 'caliper'...
remote: Counting objects: 3298, done.
remote: Finding sources: 100% (3298/3298), done.
remote: Total 3298 (delta 1755)
Receiving objects: 100% (3298/3298), 7.14 MiB | 1.94 MiB/s, done.
Resolving deltas: 100% (1755/1755), done.

And then nothing, it just hangs. If you go and have a look, you can see that files are downloaded, but not unpacked. As all other people on Internet, I have no idea why that is happening, but eventually I have found a way to get files out of it.

When it hangs, just kill the process with Ctrl+C and run this command in repository folder:

$ git fsck
notice: HEAD points to an unborn branch (master)
Checking object directories: 100% (256/256), done.
Checking objects: 100% (3298/3298), done.
notice: No default references
dangling commit 2916d1238ca0f4adecbda580ef4329a649fc777c
Now just merge that dangling commit:
$ git merge 2916d1238ca0f4adecbda580ef4329a649fc777c
and from now on you can enjoy repository content in any way you want.

5 comments:

Felipe said...

Unfortunately, I'm having the same problem when cloning something from Github and while trying your method there were several dangling commits, not just one, and trying to merge one after the other gave me conflicts. :(

Felipe said...

Hello again! I found an easier way, actually. Since the pack files have been downloaded correctly all you need to do is to interrupt the process with Ctrl+C, do a git fetch to fetch branch information from the remote repository and checkout the master (or any other) branch again with a git checkout master.

That worked well for me.

Stas said...

Thanks mate! Can be useful in case of conflcts.

Tom said...

This link actually identifies the issue and offers a workaround: http://code.google.com/p/gerrit/issues/detail?id=2406, assuming that you use TortoiseGIT in combination with Putty for SSH.

The reason for that is the GIT repository not keeping to SSH protocol standards or something, making the GIT client wait indefinitely. This can be solved by circumventing the issue by forcing a "bug" workaround in the Putty settings to enabled instead of auto. More info can be found via the link.

Pablo Videla said...

Excellent , this resolve my problem with stuck in packing objects, thanks very much !