9

I work on a Linux system in a Windows environment. To authenticate with a NT proxy server I had setup cntlm and configured system programs to use it via setting http_proxy environment variable in the /etc/environment file.

Now I want to remove this proxy setting and have the programs connect directly.

So I unset the system environment variables:

unset http_proxy
unset HTTP_PROXY

Check ~/.gitconfig to ensure that there are no proxy entries.

Explicitly instruct git not to use any proxies:

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

Verify that no proxy is configured:

git config --system --get https.proxy 
git config --global --get https.proxy 
git config --system --get http.proxy 
git config --global --get http.proxy 

And then push to a remote repo:

git push

But git still tries to connect via proxy:

fatal: unable to access 'https://xxx@bitbucket.org/xxx.git/': Failed to connect to 127.0.0.1 port 3128: Connection refused

Why won't it let go off cntlm?

Kshitiz Sharma
  • 17,947
  • 26
  • 98
  • 169
  • did you check if there are any proxy set? `env|grep -i proxy` – VonC Jun 24 '15 at 07:40
  • @VocC Thanks VonC. I thought I had removed proxy by `unset http_proxy`. But there is a different environment variable for HTTPS which needs to be unset separately. Running `env|grep -i proxy` revealed that. – Kshitiz Sharma Jun 24 '15 at 08:38
  • @VonC I have uninstalled cntlm from the system using `apt-get remove cntlm`. Do you know how I can debug why (and from where) the variable is being set now? – Kshitiz Sharma Jun 24 '15 at 08:46
  • Do you mean the HTTP_PROXY keeps being set? – VonC Jun 24 '15 at 08:49
  • @VonC Yes. I have to manually unset every time I open a new terminal window. I've tried `rgrep https_proxy` in my home directory and `/etc` but can't find anything. – Kshitiz Sharma Jun 24 '15 at 09:05
  • Did you check your .profile or .bashrc or other .xxx files? – VonC Jun 24 '15 at 10:19
  • @VonC Ah yes. I think that gets covered under `cd ~; rgrep https_proxy` – Kshitiz Sharma Jun 24 '15 at 10:28

3 Answers3

17

The easiest check to do is:

env|grep -i proxy

The OP confirms:

I thought I had removed proxy by unset http_proxy.
But there is a different environment variable for HTTPS which needs to be unset separately. Running env|grep -i proxy revealed that.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
7
  1. use cat ~/. this will list all the files.
  2. use cat ~/.gitconfig this will open the contents of file.
  3. If you find any proxies there remove it like

    [http] proxy = http://127.0.0.1:3128

  4. You can remove it by using nano ~/.gitconfig command.

  5. Now this command will work.

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

ALSO REMEMBER to remove all the proxies like

unset http_proxy="http_proxy"
unset https_proxy=$http_proxy
unset ftp_proxy=$http_proxy
unset rsync_proxy=$http_proxy
unset HTTP_PROXY=$http_proxy
unset HTTPS_PROXY=$http_proxy
unset FTP_PROXY=$http_proxy
unset RSYNC_PROXY=$http_proxy

Remember to remove proxies from system preferences network and proxies uncheck all the check boxes now try to do.

venky
  • 221
  • 3
  • 4
0

I had the same problem. When I ran

env| grep -i proxy

there was no output, so it seemed I didn't have any proxies.

Then I checked '~/.gitconfig':

[http]
        sslVerify = false
        postBuffer = 1048576000
        proxy = 192.168.0.xx:xxxx
[https]
        proxy = 192.168.0.xx:xxxx

I removed those two proxy = ... lines, then when running any git-remote related command, everything was fine.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
crescent
  • 1
  • 1