SSH in git behind proxy on windows 7 SSH in git behind proxy on windows 7 windows windows

SSH in git behind proxy on windows 7


Setting http.proxy will not work for ssh. You need to proxy your ssh connection. See this description. To summarize:

Start git-cmd.bat and create ~/.ssh/config (notepad %home%\.ssh\config.)

ProxyCommand /bin/connect.exe -H proxy.server.name:3128 %h %pHost github.com  User git  Port 22  Hostname github.com  IdentityFile "C:\users\username\.ssh\id_rsa"  TCPKeepAlive yes  IdentitiesOnly yesHost ssh.github.com  User git  Port 443  Hostname ssh.github.com  IdentityFile "C:\users\username\.ssh\id_rsa"  TCPKeepAlive yes  IdentitiesOnly yes

(set the correct proxy hostname:port, and the path to id_rsa. When you use git-bash, use slashes in the path to id_rsa)
(My version of msysgit includes connect.exe, so I do not need to download and compile connect.c). A precompiled exe is also available here.

Now ssh github.com should work

Note that if you want to connect via a socks5 proxy, then change -H to -S.

ProxyCommand connect -S proxy.server.name:1080 %h %p

If you use a Linux file system, the file permission of ~/.ssh/config must be 600, but on a standard NTFS windows partition, these kind of permissions do not exist.

If your proxy requires NTLM authentication, you can use cntlm, see also this answer.


Does your proxy require a password? Then it might be that.

export http_proxy="http://<domain>\<username>:<password>@<server>:<port>"

See : How do I pull from a Git repository through an HTTP proxy? (duplicate!)