105

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

14 Answers 14

212

Check your enviroment:

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

and delete with export http_proxy=

Check your git config files for a proxy:

git config -l --show-origin | grep "proxy"

You can unset a global proxy <user_directory>/.gitconfig:

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

Or a proxy from the local config .git/config:

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

It is also possible that the proxy is from a system config file.

3
  • 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
    Commented Jul 13, 2020 at 7:53
  • 1
    Please consider adding git config -l --show-origin as suggested by @phani-rithvij @vonc and jiang-flori. This eliminates guesswork and enables you to see where the proxy config is coming from.
    – everdream
    Commented Jul 12, 2023 at 11:45
  • Well done. This is working like a charm.
    – Niz.Dam
    Commented Jul 30, 2023 at 10:32
14

Did you already check your proxys here?

git config --global --list

or

git config --local --list
0
7

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)

5

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. Commented Apr 27, 2021 at 17:18
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
    Commented 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. Commented Dec 24, 2019 at 11:26
  • It is global, but not permanent.It removes proxy for the current terminal session
    – Mouli
    Commented Jun 6, 2020 at 14:23
3

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.

2

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
    Commented Jul 12, 2022 at 0:47
1

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
    Commented 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
    Commented 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
    Commented Apr 13, 2018 at 7:55
  • 1
    @Mr.Hyde Yes, these days, a git config -l --show-origin can help track those settings.
    – VonC
    Commented 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
    Commented 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

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

For windows I used ( set to empty value )

set https_proxy=
set http_proxy=

I seems that git uses these global variables too

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.