git clone with NTLM proxy hangs after resolving deltas

时间秒杀一切 提交于 2019-12-18 11:54:34

问题


I saw here many questions covering git and proxy topics but none of them solves my problem. I am cloning a git repository from Bitbucket. Everything works fine from my home network but hangs at work where we are using proxy with NTLM authentication. See the output of git clone command:

$ git clone https://my_user@bitbucket.org/my_user/my_project.git --verbose
Cloning into 'my_project'...
Password for 'https://my_user@bitbucket.org':
POST git-upload-pack (174 bytes)
remote: Counting objects: 548, done.
remote: Compressing objects: 100% (367/367), done.
remote: Total 548 (delta 216), reused 0 (delta 0)
Receiving objects: 100% (548/548), 5.28 MiB | 533 KiB/s, done.
Resolving deltas: 100% (216/216), done.

git clone command always hangs on "Resolving deltas".

My setup:

  • Windows 7 64-bit with msysgit 1.8.0
  • proxy configured:

    $git config --global http.proxy http://MY_DOMAIN\\\my_user:my_password@http-proxy:8080
    

It seems that the problem is somehow related to git object size because git clone used to work at the very beginning when I had few files only in my repository.


回答1:


I hit the same issue, with Git 1.7.11. All my attempts to clone from GitHub result in a hung process with no files. I tried the verify-pack trick and many other suggestions in similar questions but nothing worked.

I figured maybe this has been improved or fixed in the latest version of Git, so I upgraded to 1.8.3. Bingo, now it works, I can clone!




回答2:


Sorry, my english is very bad. Hope you can understand.

I got the same problem here. I can't find and fix the problem but i finally able to checkout. When git clone hangs on "Resolving deltas", kill the git process. So, you have folder my_project, and file .git\objects\pack\pack-<sha1>.pack. Now, we need to find the revision number. Type this command below:

git verify-pack -v .git\objects\pack\pack-<sha1>.pack | grep "commit" | more

and the output is something like this:

98c9f779992fc9a52372e0a1a76647e5d9ca5e01 commit 340 227 12
b6435d98f7b62ce69c59ce582beddf547f26d8a2 commit 305 208 239
a2a39a0c707b2919c87b194dca9a0dea307ce069 commit 239 159 447
...
4803e013b30dc9d31e4a8dba7e1a2d65e6f61422 commit 243 167 6768
-- More  --    

The 98c9f779992fc9a52372e0a1a76647e5d9ca5e01 at the top is HEAD revision, so you can checkout to this point:

git checkout -b master 98c9f779992fc9a52372e0a1a76647e5d9ca5e01

Done.




回答3:


I have the same issue and although I can't pinpoint the cause I have what I reckon is a slightly better workaround than using verify-pack and checkout the last commit as explained by cakyus.

The problem with checking out the last commit as the master branch is that you can't guarantee that the commit belongs to that branch in particular, so what I did was:

  • Interrupt the git process that hung on resolving deltas with Ctrl+C
  • Fetch branch information with git fetch
  • Checkout the master branch (or any other branch) with git checkout master

This made git set up my branch master to track remote branch master and unpack the files correctly while also preserving branch information.




回答4:


Not an answer, just contributing symptoms to narrow down the cause of this problem. I have the exact same issue. It just sits there "resolving delta's".

v1.7.10 Win2008 R2 Enterprise Proxy has been configured for HTTP and HTTPs.

I'll get a collegue to login to the server (.gitconfig is part of his roaming profile) and see whether it's the config or the install.




回答5:


The solution that works for me from comments on this blog http://stas-blogspot.blogspot.ca/2012/12/git-hangs-after-resolving-deltas.html:

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.

so the solution is just to kill the hanging process and then:

git fetch
git checkout



回答6:


Two things (April 2019, seven years later):

  1. Don't declare the NTML proxy URL directly. Set HTTP_PROXY and HTTPS_PROXY environment variables to and HTTP proxy (not an NTLM one) with, for instance, genotrance/px.
    By running px (which redirects to your NTLM proxy), you can refers to a classic HTTP proxy (typically http://localhost:3128, no need for your login/password!), and this will work better.

  2. If the "Resolving deltas" still takes time, make sure to use Git 2.22 (Q2 2019)

On that second point: A progress indicator has been added to the "index-pack" step, which often makes users wait for completion during "git clone".

See commit 79e3aa6 (31 Mar 2019) by SZEDER Gábor (szeder).
(Merged by Junio C Hamano -- gitster -- in commit da924b5, 25 Apr 2019)

index-pack: show progress while checking objects

When 'git index-pack' is run by 'git clone', its check_objects() function usually doesn't take long enough to be a concern, but I just run into a situation where it took about a minute or so: I inadvertently put some memory pressure on my tiny laptop while cloning linux.git, and then there was quite a long silence between the "Resolving deltas" and "Checking connectivity" progress bars.

Show a progress bar during the loop of check_objects() to let the user know that something is still going on.



来源:https://stackoverflow.com/questions/13473341/git-clone-with-ntlm-proxy-hangs-after-resolving-deltas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!