使用域设置 Git 代理

Set up Git Proxy with a domain

我想通过Windows上的代理在工作中使用git 7。我公司有各种可用的代理。为了通过 Python pip 使用的代理,我使用了 Cntlm 程序。使用 Cntlm,我能够指定我的 domain\username 和密码,并使用它通过/绕过代理服务器进行连接。

不是我想用git。我不知道将域名放在git的代理设置中的什么位置。以下是我在 Windows 7.

上在 cmd 中执行的步骤
set HTTP_PROXY=http://domain\username:password@proxyaddress:proxyport
git config --global http.proxy $HTTP_PROXY
git clone git://github.com/destination.git folder

即使我的所有信息都是正确的并且 Cntlm 使用相同的信息,这仍然会超时。有人可以协助正确的程序让 git 通过这样的代理工作吗?

在 windows 上,您必须使用 %YOUR_VAR% 来引用您的变量。 所以我认为主要问题是这个错误。 您已经在此处 post ->

要从 https 代理设置中受益,您至少应该使用 https 协议。

# not:
git clone git://github.com/destination.git folder
# but
git clone https://github.com/destination.git folder

注意:如果设置了环境变量,它将被 git 获取,即使 git 配置 http(s).proxy 没有完成。
你应该同时定义 HTTP_PROXY 和 HTTP_PROXY。

您将在“Setting git to work behind NTLM-authenticated proxy: cntlm to the rescue ”找到更完整的示例。
OP Cornel Verster mentions :

When using Cntlm, you should set your git http.proxy to localhost:3128 as well as you HTTP_PROXY (127.0.0.1:3128) and HTTPS_PROXY (127.0.0.1:3128) variables.