开发者

Git, Behind Proxy and Keep Getting HTTP code = 417

our company provide internet access for us using proxy, but after configured http.proxy, i am keeping get HTTP code 417 After a little google, i guess it's because the libcurl that git use sent the "Expect: 100-continue" header, which the proxy(i guess a Squid) does not understand and reply with 417: Expection failed.

I can not change the proxy setting, so below are my questions:

  1. can i disable the Expect header of libcurl? i know i can use -H option of curl(the binary), but seems git/ libcurl does not support this option.
  2. or how can i get around this problem without do a开发者_如何学编程nything with the proxy ?

Thanks in advance,


It sounds like you're trying to use Git through the proxy? You could try this:

git config --global http.proxy="http://<user>:<password>@<proxy address>:<proxy port>"

For example,

git config --global http.proxy="http://jonathan:Password1@webproxy:8090"

Then, when performing a git clone or setting up a git remote, use http:// instead of git:// as the protocol.


I do not know about proxying with Squid, but if you only need to pull, could you mirror the git repository with curl or wget to a local folder, and then tell git to use that instead?


I had similar problem, it seems that I could push small changes through (under 1 kb) but when trying it with larger push our proxy server kicked in (which uses Squid probably) and I got following trace as a result:

Counting objects: 50, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (29/29), 3.47 KiB, done.
Total 29 (delta 11), reused 0 (delta 0)
error: RPC failed; result=22, HTTP code = 417
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

Problem was solved by unsetting all proxy settings from git as:

git config --global --unset-all http.proxy # to remove it from the global config
git config --unset-all http.proxy  # to remove it from the local repo config file

And adding our (stash git) LAN ip/domain to /etc/hosts as:

sudo /etc/hosts

Inside that file I added following:

192.168.xx.xxx  git.ourcompany.com

And boom, problem solved! (Dont forget to start up new terminal where you try that push.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜