使用代理后面的git [英] Working with git behind proxy

查看:327
本文介绍了使用代理后面的git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代理后面。要获得 git 工作,我必须添加

  proxy = http: //username:password@proxy.at.your.org:8080 

.gitconfig



由于 username / code>是我的系统凭据这个解决方案吸引,因为我必须存储这些 cleartext



我使用 Google Chrome ,我不需要设置任何代理设置,因为它使用系统代理设置。



如何使用 git

解决方案

2016年2月更新:



使用git 2.8(2016年3月)您的密码。



请参阅提交372370f 提交ef97639 (2016年1月26日)由 Knut Franke(``)

帮助: Junio C Hamano( gitster Eric Sunshine( sunshinebell28 Elia Pinto ( devzero2000

(合并者为 gitster
30f302f7e7f407c0444b32e264aaa72c4081011erel =nofollow> commit 30f302f ,2016年2月3日)


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



目前,将代理凭证传递到curl的唯一方法是将它们包含在代理中网址。通常,这意味着它们将以不加密的方式(通过包含在〜/ .gitconfig ,shell配置文件或历史记录中)结束在磁盘上。

由于代理身份验证通常使用域用户,凭证可能是安全敏感的;因此,需要一种更安全的传递凭证的方式。



如果配置的代理包含用户名而不是密码,请查询
凭证API。此外,请确保我们正确批准/拒绝代理凭证

所以:



除了curl理解的语法之外,还可以指定一个具有用户名但没有密码的代理字符串,在这种情况下,git将尝试以与其他凭据相同的方式获取一个。

请参见

因此语法为:




  [protocol://] [user [:password] @] proxyhost [:port] 

这可以在每个远程的基础上覆盖;请参阅 remote。< name> .proxy







2015年10月更新



由于git 1.8.0 commit 7bcb747 ,默认的Windows凭据助手是 wincred ,它是与Windows的凭据管理器连接的git凭据助手。

  git config --global credential.helper wincred 


b $ b




原始答案(2013年3月):



您可以使用凭证助手(git1.7.9 +)例如 git-credential-winstore ,以便存储您的凭据。

您将使用' git config --global凭证.helper winstore '。

然后,您可以在不输入用户名和密码的情况下声明您的代理:

  git config --global http.proxy http://proxy.server.com:8080 


$ b b

(虽然我更喜欢使用环境变量 http_proxy https_proxy



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





I'm behind a proxy. To get git working I would have to add

proxy = http://username:password@proxy.at.your.org:8080

to .gitconfig.

Since username and password are my system credentials this solution sucks because I would have to store these as cleartext.

I'm using Google Chrome where I don't need to setup any proxy settings because it uses the system proxy settings.

How to do that with git?

解决方案

Update February 2016:

With git 2.8 (March 2016), you don't have to embed in clear text your password in the url.

See commit 372370f, commit ef97639 (26 Jan 2016) by Knut Franke (``).
Helped-by: Junio C Hamano (gitster), Eric Sunshine (sunshinebell28), and Elia Pinto (devzero2000).
(Merged by Junio C Hamano -- gitster -- in commit 30f302f, 03 Feb 2016)

http: use credential API to handle proxy authentication

Currently, the only way to pass proxy credentials to curl is by including them in the proxy URL. Usually, this means they will end up on disk unencrypted, one way or another (by inclusion in ~/.gitconfig, shell profile or history).
Since proxy authentication often uses a domain user, credentials can be security sensitive; therefore, a safer way of passing credentials is desirable.

If the configured proxy contains a username but not a password, query the credential API for one. Also, make sure we approve/reject proxy credentials properly. So:

In addition to the syntax understood by curl, it is possible to specify a proxy string with a user name but no password, in which case git will attempt to acquire one in the same way it does for other credentials.
See gitcredentials for more information.
The syntax thus is:

[protocol://][user[:password]@]proxyhost[:port]

This can be overridden on a per-remote basis; see remote.<name>.proxy.


Update Oct. 2015

Since git 1.8.0 and commit 7bcb747, the default Windows credential helper is wincred, a git credential helper that interface with Windows' Credential Manager.

 git config --global credential.helper wincred


Original answer (March 2013):

You can use a credential helper (git1.7.9+) like git-credential-winstore on Windows, in order to store your credentials.
You will declare it with a 'git config --global credential.helper winstore'.
You can then declare your proxy without putting your username and password:

git config --global http.proxy http://proxy.server.com:8080

(although I prefer using environment variables http_proxy and https_proxy)

See also "git: 'credential-cache' is not a git command"


这篇关于使用代理后面的git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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