16

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?

Right now the error is: "Couldn't resolve proxy 'asdf' while accessing ... fatal: HTTP request failed.

2 Answers 2

38

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.

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:

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.

1
  • 1
    In my case, I had ProxyCommand set up in ~/.ssh/config, which I had to remove on top what @mamapitufo mentioned. Jun 26, 2016 at 13:56
0

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.

On Windows for instance, if you have access to the registry, you can look for the proxy settings there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.