16

我试图弄清楚这个 git 事情,有一次我弄乱了 http.proxy 变量。现在这只是胡说八道,'asdf'所以推送不起作用。我不知道之前的代理设置是什么(我什至不知道代理服务器是什么)。有什么方法可以将 http.proxy 设置为正确的值?

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

4

2 回答 2

36

您错误地在 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

我希望这有帮助。

于 2012-07-16T08:52:25.343 回答
0

git config 文件是一个本地文件(即它没有被推送到远程仓库)。
因此,除非您有某种本地历史记录/备份机制(例如 Mac 上的 TimeMachine),否则您无法轻松恢复它。

例如,在 Windows 上,如果您有权访问注册表,则可以在那里查找代理设置

于 2012-07-16T07:59:12.533 回答