97

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?

PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
Leeuwtje
  • 2,161
  • 5
  • 21
  • 28
  • what does `git config --list | grep proxy` tell you about your proxy settings? – eckes Aug 28 '15 at 10:55
  • Possible duplicate of [Reset git proxy to default configuration](https://stackoverflow.com/questions/11265463/reset-git-proxy-to-default-configuration). – jww Jun 24 '17 at 20:16
  • git config --global --unset https.proxy For https configuration – Dinith Oct 27 '19 at 14:03

13 Answers13

201

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.

PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
  • Thank you for this solution! I got the error `Unsupported proxy syntax in :` 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 '20 at 07: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 Jul 12 '23 at 11:45
  • Well done. This is working like a charm. – Niz.Dam Jul 30 '23 at 10:32
14

Did you already check your proxys here?

git config --global --list

or

git config --local --list
Yorsh
  • 540
  • 7
  • 9
6

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)

Dinith
  • 839
  • 14
  • 22
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.

Phani Rithvij
  • 4,030
  • 3
  • 25
  • 60
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'
Mouli
  • 41
  • 3
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)
Laurel
  • 5,965
  • 14
  • 31
  • 57
  • 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](/help/how-to-answer). – Community Jul 12 '22 at 00:47
2

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.

Sean
  • 1,055
  • 11
  • 10
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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 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 '18 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 '18 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 '18 at 07:55
  • 1
    @Mr.Hyde Yes, these days, a `git config -l --show-origin` can help track those settings. – VonC Apr 13 '18 at 08:10
  • after deleting Windows environment variables you should relog to ensure they really disappear from all open instances of Explorer. – Juergen Sep 10 '18 at 08: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 ""
Vallabha Vamaravelli
  • 1,153
  • 1
  • 9
  • 15
0
git config --global --unset http.proxy
git config --unset http.proxy
http_proxy=""
Amit
  • 2,389
  • 22
  • 29
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
piyush sachdeva
  • 416
  • 4
  • 14
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 !