Unable to run TortoiseGit + cntlm + proxy server

2019-07-03 22:30发布

问题:

I'm tryng to start using Git on GitHub. Unfortunately I can't manage to get it working, I always receive, when I try to clone the repository, the message "Connection refused". Since I'm behind a proxy server I suppose the problem is there, but I don't know how to fix.

Below what I tryed so far: I open the account on GitHub then I generated a key with putty gen: I saved the private key (2) on the disk and sent the public(1) into the github place for SSH keys: Then I used the private key in the clone phase as below:

This did not work for me, so I tryed to authenticate with my proxy using Cntlm and setting it to point the enterprise proxy. Then I changed the tortoisegit configuration as below:

but when I try to clone I'm always facing the "Connection Refused" error. The Cntlm configuration file looks like:

Username    fpollano
Domain      mydomain
PassLM          93D6A9F56CD43B4571101CC5806411F2
PassNT          5FD9AD7F1504A469D994241648972131
PassNTLMv2      7255AE1CBA2511A751F848FC34087011    
#Workstation    netbios_hostname    # Should be auto-guessed

Proxy       192.168.1.5:8080

( I even check with clear password, with same results )

Anyone know a solution ? Alternatively any way to get some of these agents log something somewhere ? Thanks to all !

回答1:

On windows, it will help if you have the following environment variables defined before any pull/push using https GitHub address:

http_proxy="http://username:password@proxy:port/"
https_proxy="http://username:password@proxy:port/"
HOME=C:\Path\To\HOME

(http_proxy in lowercase)

Your %HOME% (which isn't defined by default on Windows) can be any path, but it must be the parent directory of your .ssh which contains your id_rsa.pub and id_rsa files (your public and private keys)

In your %HOME%, you will also need an _netrc file:

machine github.com
login loginGitHub
password passwordGitHub

From there, you will be able to clone your GitHub repo:

git clone https://github.com/Login/repo

To debug those kind of connection errors, set GIT_CURL_VERBOSE=1, and make sure your CApath is correct.

git config --system http.sslcainfo "C:\path\to\your\git\bin\curl-ca-bundle.crt"


回答2:

I had this issue. Our Sys admin forced Internet traffic to go through a proxy and I was suddenly unable to push/pull to/from GitHub. I tried VonC's answer with no luck. Fortunately our Sys Admin whitelisted github.com on the Firewall and I was back in business. So it doesn't hurt to ask. :)