使用代理后面的git

Raz*_*zer 6 windows git configuration proxy

我在代理人后面.为了git工作,我将不得不添加

proxy = http://username:password@proxy.at.your.org:8080
Run Code Online (Sandbox Code Playgroud)

.gitconfig.

既然username并且password是我的系统凭证,这个解决方案很糟糕,因为我必须将它们存储为cleartext.

我正在使用Google Chrome我不需要设置任何代理设置的地方,因为它使用系统代理设置.

怎么做git

Von*_*onC 6

2016年2月更新:

使用git 2.8(2016年3月),您无需在网址中以明文形式嵌入密码.

请参阅Knut Franke的提交372370f,提交ef97639(2016年1月26日)(``).
帮助:Junio C Hamano(gitster),Eric Sunshine(sunshinebell28)Elia Pinto(devzero2000).
(由Junio C gitsterHamano合并- -提交30f302f,2016年2月3日)

http:使用凭证API来处理代理身份验证

目前,将代理凭据传递给curl的唯一方法是将它们包含在代理URL中.通常,这意味着它们将以某种方式(通过包含在~/.gitconfigshell配置文件或历史记录中)以未加密的方式结束到磁盘上.
由于代理身份验证通常使用域用户,因此凭据可能对安全性敏感; 因此,需要一种更安全的通过凭证的方式.

如果配置的代理包含用户名但不包含密码,请查询凭证API.此外,请确保我们正确批准/拒绝代理凭据.所以:

除了curl理解的语法之外,还可以指定具有用户名但没有密码代理字符串,在这种情况下,git将尝试以与其他凭据相同的方式获取一个代理字符串.
有关更多信息,请参阅gitcredentials.
语法因此是:

[protocol://][user[:password]@]proxyhost[:port]
Run Code Online (Sandbox Code Playgroud)

这可以在每个远程基础上被覆盖; 看remote.<name>.proxy.


2015年10月更新

从git 1.8.0commit 7bcb747开始,默认的Windows凭证帮助程序是wincred一个git凭证帮助程序,它与Windows的Credential Manager连接.

 git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)

原始答案(2013年3月):

您可以使用证书助手(git1.7.9 +)喜欢的git-凭据winstore在Windows上,以便存储您的凭据.
你将用' git config --global credential.helper winstore' 声明它.
然后,您可以在不输入用户名和密码的情况下声明代理:

git config --global http.proxy http://proxy.server.com:8080
Run Code Online (Sandbox Code Playgroud)

(虽然我更喜欢使用环境变量http_proxyhttps_proxy)

另请参阅" git:' credential-cache'不是git命令 "