0

Not sure if this question belongs in this forum but I'll give it a chance.

I'm trying to connect my Ubuntu with GitHub via a proxy so I can clone repositories via the git command.

I've followed the normal steps to add the proxy settings to the .gitconfig file in /var/www/. The settings are visible in the config file:

[http] proxy = http://PROXYUSR:PROXYPWD@PROXYHOST:PROXYPORT
[https] proxy = http://PROXYUSR:PROXYPWD@PROXYHOST:PROXYPORT

Result when I try to access GitHub:

root@server:/var/www/# git clone https://github.com/CybOXProject/python-cybox.git Cloning into 'python-cybox'...

fatal: unable to access 'https://github.com/CybOXProject/python-cybox.git/': 
Received HTTP code 407 from proxy after CONNECT

When running the git clone command a tcpdump reveals that it is trying to connect to our proxy but lacks the authentication method/credentials. This behaviour is substantiated by looking at the logs of the proxy. The connection is denied because it's not authenticating.

xxxx.55728 > servername.domain.http-alt: Flags [P.], cksum 0x1efc (incorrect -> 0xf2a3), seq 111:222, ack 2957, win 275, options [nop,nop,TS val 4130126559 ecr 801030698], length 111: HTTP, length: 111
        CONNECT github.com:443 HTTP/1.1
        Host: github.com:443
        User-Agent: git/2.14.1
        Proxy-Connection: Keep-Alive

An application running on the same server is using the proxy with the same authentication method/credentials with success.

Any suggestions?

Tim Diekmann
  • 7,755
  • 11
  • 41
  • 69
  • 1
    Possible duplicate of [Getting git to work with a proxy server](https://stackoverflow.com/questions/783811/getting-git-to-work-with-a-proxy-server) – Miron Aug 03 '18 at 15:35
  • Solved. I didn't realise that the following command is needed to force git to send the credentials and authentication method to the proxy: `git config --global http.proxyAuthMethod 'basic'` Source: https://git-scm.com/docs/git-config#git-config-httpproxyAuthMethod – Something Aug 07 '18 at 10:41

0 Answers0