Git http.proxy设置

时间:2012-07-16 07:25:09

标签: git proxy

我试图想出这个git的东西,有一刻我搞砸了http.proxy变量。现在它只是胡说八道,'asdf'所以推动不起作用。我不知道之前代理设置是什么(我甚至不知道代理服务器是什么)。有什么方法可以将http.proxy设置为正确的值吗?

现在错误是:“访问时无法解析代理'asdf'...致命:HTTP请求失败。

2 个答案:

答案 0 :(得分:30)

您错误地在git配置文件中添加了一个条目。您可以使用git config操作全局和每个存储库配置文件。

要了解是否将代理条目添加到全局或本地配置文件,请从控制台运行:

git config -l --global | grep http  # this will print the line if it is in the global file
git config -l | grep http # this will print the line if it is in the repo config file

然后从全局或本地文件中删除所有http.proxy条目,运行:

git config --global --unset-all http.proxy # to remove it from the global config
git config --unset-all http.proxy  # to remove it from the local repo config file

我希望这会有所帮助。

答案 1 :(得分:0)

git配置文件是本地配置文件(即它不会被推送到远程仓库) 因此,除非你有某种本地历史/备份机制(如Mac上的TimeMachine),否则无法轻松恢复。

例如,在Windows上,如果您有权访问注册表you can look for the proxy settings there