Leeuwtje
Leeuwtje

Reputation: 2271

Git: How to remove proxy

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?

Upvotes: 107

Views: 251638

Answers (14)

Alireza Fattahi
Alireza Fattahi

Reputation: 45573

For windows I used ( set to empty value )

set https_proxy=
set http_proxy=

I seems that git uses these global variables too

Upvotes: 0

PiTheNumber
PiTheNumber

Reputation: 23552

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.

Upvotes: 214

Sean
Sean

Reputation: 1193

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.

Upvotes: 3

Georges Damien
Georges Damien

Reputation: 39

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 !

Upvotes: 0

jiang Flori
jiang Flori

Reputation: 21

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)

Upvotes: 2

Trương Quang Chứ
Trương Quang Chứ

Reputation: 21

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

Upvotes: 0

piyush sachdeva
piyush sachdeva

Reputation: 456

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

Upvotes: 0

Amit
Amit

Reputation: 2725

git config --global --unset http.proxy
git config --unset http.proxy
http_proxy=""

Upvotes: 0

Vallabha Vamaravelli
Vallabha Vamaravelli

Reputation: 1293

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 ""

Upvotes: 0

Phani Rithvij
Phani Rithvij

Reputation: 4497

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.

Upvotes: 6

Dinith
Dinith

Reputation: 1039

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)

Upvotes: 7

Mouli
Mouli

Reputation: 41

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'

Upvotes: 4

Yorsh
Yorsh

Reputation: 560

Did you already check your proxys here?

git config --global --list

or

git config --local --list

Upvotes: 14

VonC
VonC

Reputation: 1327634

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

Upvotes: 1

Related Questions