Git http.proxy 设置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11499805/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git http.proxy Setting
提问by ShrimpCrackers
I was trying to figure this git thing out and at one moment I messed with the http.proxy variable. Right now it's just nonsense, 'asdf' so pushing doesn't work. I don't know what the proxy setting was before (I don't even know what proxy server is). Any way to set http.proxy to the correct value?
我试图弄清楚这个 git 问题,有一次我弄乱了 http.proxy 变量。现在这只是胡说八道,'asdf'所以推动不起作用。我不知道之前的代理设置是什么(我什至不知道代理服务器是什么)。有什么方法可以将 http.proxy 设置为正确的值?
Right now the error is: "Couldn't resolve proxy 'asdf' while accessing ... fatal: HTTP request failed.
现在的错误是:“访问时无法解析代理‘asdf’……致命:HTTP 请求失败。
回答by mamapitufo
You added an entry to your git config file by mistake. You can manipulate the both the global and per-repository config files using git config
.
您错误地在 git 配置文件中添加了一个条目。您可以使用git config
.
To find out if you added the proxy entry to the global or local config files run this from the console:
要了解您是否将代理条目添加到全局或本地配置文件,请从控制台运行:
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
Then to remove all the http.proxy
entries from either the global or the local file run this:
然后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
I hope this helps.
我希望这有帮助。
回答by VonC
The git config file is a local one (ie it is not pushed to a remote repo).
So unless you have some kind of local history/backup mechanism in place (like TimeMachine on Mac), you cannot restore it easily.
git 配置文件是本地文件(即它不会推送到远程仓库)。
因此,除非您有某种本地历史/备份机制(如 Mac 上的 TimeMachine),否则您无法轻松恢复它。
On Windows for instance, if you have access to the registry, you can look for the proxy settings there.
例如,在 Windows 上,如果您有权访问注册表,则可以在那里查找代理设置。