9

我在代理后面工作,我无法访问 github.com。我读到 cntlm 可以解决这个问题。我仍在努力填写代理信息。

所以我的问题是,如何让 Git 使用 cntlm 绕过代理?

4

2 回答 2

28

如果你真的想使用 CNTLM,它会被配置为像常规代理一样的 git。

因此,您可以像这样指定 NTLM 代理:

git config --global https.proxy https://user:password@proxy.com:port
git config --global http.proxy http://user:password@proxy.com:port

对于 CNTLM,您只需使用 localhost 指定 CNTLM 监听的端口:

git config --global https.proxy https://127.0.0.1:port
git config --global http.proxy http://127.0.0.1:port

我让它在本地端口 3128 上运行,所以对我来说是

git config --global https.proxy https://127.0.0.1:3128
git config --global http.proxy http://127.0.0.1:3128

即使 git 支持 NTLM 代理,您也可能不想以这种方式使用它,因为它以明文形式存储您的用户/密码。使用 CNTLM,您可以使用可以将密码存储为加密的集中位置。

于 2012-11-05T10:55:04.683 回答
6

对于 git 版本 1.7.10 和更高版本,您不需要 CNTLM,因为这是您的情况。

有关详细信息,请在此处查看我的答案https://stackoverflow.com/a/10848870/352672,您可以这样配置/测试:

git config --global http.proxy http://user:password@proxy.com:port
git clone http://git.gnome.org/browse/gnome-contacts
于 2012-11-05T10:49:30.830 回答