如何设置Git以通过代理 [英] How to set up Git to get through a proxy

查看:557
本文介绍了如何设置Git以通过代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在工作中连接到GitHub,需要通过http代理。我可以使用cURL使用命令

I want to connect to GitHub at work and need to get through the http proxy. I am able to get out for FTP using cURL using the command


curl -v -g --ftp- pasv --upload-file MYFILE --proxy PROXYADDRESS:PROXYPORT --proxy-ntlm --proxy-user WINDOWSDOMAIN\WINDOWSUSER:WINDOWSPASSWORD ftp:// FTPUSER:FTPPASS @ FTPURL /

我到目前为止还无法为Git提供同等的设置。

I've so far not been able to provide equivalent settings for Git.

我尝试按照在cygwin上使用Github Through Draconian代理中的说明操作。

I tried following instructions on Using Github Through Draconian Proxies under cygwin.

我已经安装了开瓶器,并尝试SSH到GitHub

I've got corkscrew installed and tried to SSH to GitHub

ssh github.com

ssh ssh.github.com

我回来了


ssh:无法解析主机名ssh.github.com:提供主机名或伺服器名称,或不知道。

ssh: Could not resolve hostname ssh.github.com: hostname nor servname provided, or not known.

我已经尝试设置http和https代理。

I've tried setting the http and https proxy.

这是git的输出--config -l



Here is the output from git --config -l

core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=C:/Program Files/Git/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
user.name=Peter Wilkinson
user.email=someemail@gmail.com
github.user=ProggerPete
github.token=shouldprobablykeepthissecret
http.proxy=http://somedomain\someuser:somepass@10.167.116.142:80
https.proxy=http://somedomain\someuser:somepass@10.167.116.142:80

我还运行

export https_proxy=http://somedomain\someuser:somepass@10.167.116.142:80
export http_proxy=http://somedomain\someuser:somepass@10.167.116.142:80
set https_proxy=http://somedomain\someuser:somepass@10.167.116.142:80
set http_proxy=http://somedomain\someuser:somepass@10.167.116.142:80


$ b b

然后尝试并克隆并获取。

I then try and clone and get.

$ git clone https://ProggerPete@github.com/project/JavaScript-Maven-Plugin.git
Cloning into JavaScript-Maven-Plugin...
Password:
error: The requested URL returned error: 407 while accessing https://ProggerPet
@github.com/project/JavaScript-Maven-Plugin.git/info/refs

fatal: HTTP request failed

这看起来像我失败的代理认证。

This looks to me like I'm failing authentication with the proxy. However I'm using the same login and pass that works for FTP via cURL.

我如何连接?

推荐答案

经过多次头部攻击,我终于偶然发现了 http://cntlm.sourceforge .net / 。它是一个理解ntlm身份验证的代理代理。

After much head bashing I finally stumbled across http://cntlm.sourceforge.net/. It's a proxy proxy that understands ntlm authentication.

我安装它并告诉它关于http代理。

I installed it and told it about the http proxy. Then pointed git at CNTLM and it all started working.

我发现这让人非常沮丧,希望这将帮助别人在同样的情况。

I found getting this going very frustrating so hopefully this will help someone else in the same situation.

这篇关于如何设置Git以通过代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆