I am testing SSH connection for checking RSA key in git. I am working over proxy server. I am using window 7 and have installed msysGit-fullinstall-1.7.3.1-preview20101002. Now in msys.exe window i have set proxy by command 'git config --global http.proxy http://host:port' After that i have tried command 'ssh [email protected]' . This gives me error like 'ssh: github.com: no address associated with name'
What should i do?
You need an SSH client that can issue CONNECT requests through the company HTTP proxy. If you're on Windows, using Putty is fine as it has built-in support for tunneling through a HTTP proxy. If you're on unix/linux (or cywgin) you can use openssh with corkscrew to go through the proxy to your home computer's port 443.
Setting the proxy for Git Run the following commands replacing USERNAME , PASSWORD , PROXY_ADDRESS , and PROXY_PORT with your network's information: git config --global --add http. proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT. git config --global --add https.
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 %p
Host github.com
User git
Port 22
Hostname github.com
IdentityFile "C:\users\username\.ssh\id_rsa"
TCPKeepAlive yes
IdentitiesOnly yes
Host 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With