90

I am trying to push to my repo but receiving an error:

fatal: unable to access 'https://github.com/myrepo.git/': Could not resolve proxy: --list        

I already changed the proxy settings :

git config --global --unset http.proxy  

my global config settings are:

push.default=simple
http.sslverify=false
url.https://.insteadof=git://
credential.helper=cache --timeout=3600

But still getting this error? How can I solve this?

3
  • what does git config --list | grep proxy tell you about your proxy settings?
    – eckes
    Aug 28, 2015 at 10:55
  • Possible duplicate of Reset git proxy to default configuration.
    – jww
    Jun 24, 2017 at 20:16
  • git config --global --unset https.proxy For https configuration
    – Dinith
    Oct 27, 2019 at 14:03

13 Answers 13

189

Check your enviroment:

echo $http_proxy
echo $https_proxy
echo $HTTPS_PROXY
echo $HTTP_PROXY

and delete with export http_proxy=

Or check https and http proxy

git config --global --unset https.proxy
git config --global --unset http.proxy

Or do you have the proxy in the local config?

git config --unset http.proxy
git config --unset https.proxy
3
  • 3
    the local one did it awesome
    – Leeuwtje
    Aug 28, 2015 at 10:57
  • Thank you for this solution! I got the error Unsupported proxy syntax in <proxyserver>:<port> when I tried to clone a repository and could solve the problem by deleting the proxy setting: export http_proxy=, export https_proxy=, export HTTPS_PROXY=, and export HTTP_PROXY=. After deleting the settings I could clone the repository without problems.
    – Gilfoyle
    Jul 13, 2020 at 7:53
  • OMG thank you so much I had an environment variable https_proxy set systemwide 🤦‍♂️
    – Gifford N.
    Mar 4, 2021 at 22:03
14

Did you already check your proxys here?

git config --global --list

or

git config --local --list
0
5

You config proxy settings for some network and now you connect another network. Now have to remove the proxy settings. For that use these commands:

git config --global --unset https.proxy
git config --global --unset http.proxy

Now you can push too. (If did not remove proxy configuration still you can use git commands like add , commit and etc)

4

This is in the case if first answer does not work The latest version of git does not require to set proxy it directly uses system proxy settings .so just do these

unset HTTP_PROXY
unset HTTPS_PROXY

in some systems you may also have to do

unset http_proxy
unset https_proxy

if you want to permanantly remove proxy then

sudo gsettings set org.gnome.system.proxy mode 'none'
3
  • is it global or local ?
    – Dinith
    Oct 30, 2019 at 17:51
  • Thanks, git config --unset https.proxy didn't work for me, unset https_proxy removed the proxy and I was able to connect to git. Dec 24, 2019 at 11:26
  • It is global, but not permanent.It removes proxy for the current terminal session
    – Mouli
    Jun 6, 2020 at 14:23
4

You can list all the global settings using

git config --global --list

My proxy settings were set as

...
remote.origin.proxy=
remote.origin.proxy=address:port
...

The command git config --global --unset remote.origin.proxy did not work.

So I found the global .gitconfig file it was in, using this

git config --list --show-origin

And manually removed the proxy fields.

1
  • 1
    Your answer is very useful and git config --global --unset remote.origin.proxy worked for me. Apr 27, 2021 at 17:18
0

Check if you have environment variable that could still define a proxy (picked up by curl, even if the git config does not include any proxy setting anymore):

HTTP_PROXY
HTTPS_PROXY
5
  • 1
    I had these HTTP_PROXY, HTTPS_PROXY on the environment variable in Windows 7 and removed those, but the problem still exist and git shows:Failed to connect to 127.0.0.1 port 8580: Connection refused error.
    – Dr.jacky
    Apr 12, 2018 at 16:40
  • @Mr.Hyde it looks like you still have a proxy defined somewhere: do you see in in git config -l?
    – VonC
    Apr 12, 2018 at 20:33
  • 3
    It didn't show anything. But I've solved my problem with setting [http] proxy= and [https] proxy= in C:\Users\Username\.gitconfig and C:\ProgramData\Git\config.
    – Dr.jacky
    Apr 13, 2018 at 7:55
  • 1
    @Mr.Hyde Yes, these days, a git config -l --show-origin can help track those settings.
    – VonC
    Apr 13, 2018 at 8:10
  • after deleting Windows environment variables you should relog to ensure they really disappear from all open instances of Explorer.
    – Juergen
    Sep 10, 2018 at 8:39
0

Some times, local config command won't show the proxy but it wont allow git push due to proxy. Run the following commands within the directory and see.

#git config --local --list

But the following commands displays the proxy set to local repository:

#git config http.proxy
#git config https.proxy

If the above command displays any proxy then clear it by running the following commands:

#git config https.proxy ""
#git config https.proxy ""
0
git config --global --unset http.proxy
git config --unset http.proxy
http_proxy=""
0

If you already unset the proxy from global and local level and still see the proxy details while you do

         git config -l

then unset the variable from system level, generally the configuration stored at below location

 C:\Program Files\Git\mingw64/etc/gitconfig
0

if you used remote.origin.proxy( check it by using git config --global -l ) ,then use git config --global --unset-all remote.origin.proxy .

0

Use

git config -l --show-origin

We can find the file location, and delete:

[remote "origin"]
        proxy =
        proxy = 127.0.0.1:(proxy http port number)
1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jul 12, 2022 at 0:47
0

For me it was just the IPV6 causing this error ! after uncheking the IPV6 option on the network adapter (and just using IPV4), the error disappeared !

0

Previous answers have mentioned the proxy settings in git itself. However, if you ever set an SSH proxy for your remote repository in your ssh settings in files like ~/.ssh/config etc., git uses the config to perform ssh connections.

For me, I configured an SSH proxy for all my GitHub repos:

# proxy github
Host github.com
  User git
  ProxyCommand nc -x $PROXY %h %p

Remove the settings solved my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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