Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up Git to get through a proxy

I want to connect to GitHub at work and need to get through the http proxy. I am able to get out for FTP using cURL using the command

curl -v -g --ftp-pasv --upload-file MYFILE --proxy PROXYADDRESS:PROXYPORT --proxy-ntlm --proxy-user WINDOWSDOMAIN\WINDOWSUSER:WINDOWSPASSWORD ftp://FTPUSER:FTPPASS@FTPURL/

I've so far not been able to provide equivalent settings for Git.

I tried following instructions on Using Github Through Draconian Proxies under cygwin.

I've got corkscrew installed and tried to SSH to GitHub

ssh github.com 

or

ssh ssh.github.com 

I get back

ssh: Could not resolve hostname ssh.github.com: hostname nor servname provided, or not known.

I've tried setting the http and https proxy.

Here is the output from git --config -l

core.symlinks=false core.autocrlf=true color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=C:/Program Files/Git/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain user.name=Peter Wilkinson [email protected] github.user=ProggerPete github.token=shouldprobablykeepthissecret http.proxy=http://somedomain\someuser:[email protected]:80 https.proxy=http://somedomain\someuser:[email protected]:80 

I've also run

export https_proxy=http://somedomain\someuser:[email protected]:80 export http_proxy=http://somedomain\someuser:[email protected]:80 set https_proxy=http://somedomain\someuser:[email protected]:80 set http_proxy=http://somedomain\someuser:[email protected]:80 

I then try and clone and get.

$ git clone https://[email protected]/project/JavaScript-Maven-Plugin.git Cloning into JavaScript-Maven-Plugin... Password: error: The requested URL returned error: 407 while accessing https://ProggerPet @github.com/project/JavaScript-Maven-Plugin.git/info/refs  fatal: HTTP request failed 

This looks to me like I'm failing authentication with the proxy. However I'm using the same login and pass that works for FTP via cURL.

How can I get connected?

like image 793
Programming Guy Avatar asked Oct 12 '11 02:10

Programming Guy


People also ask

How do I connect to a proxy server in Linux?

Click the "Connections" tab and find "LAN Settings". Tick the "Use a proxy server for your LAN" checkbox to be able to configure a proxy. Type the IP address (or hostname) of the proxy server in the address field, and the port the proxy is running on in the port field. Click "OK" several times.


Video Answer


1 Answers

After much head bashing I finally stumbled across http://cntlm.sourceforge.net/. It's a proxy proxy that understands ntlm authentication.

I installed it and told it about the http proxy. Then pointed git at CNTLM and it all started working.

I found getting this going very frustrating so hopefully this will help someone else in the same situation.

like image 158
Programming Guy Avatar answered Sep 24 '22 08:09

Programming Guy