在 Windows 7 上的代理后面的 git 中的 SSH [英] SSH in git behind proxy on windows 7
问题描述
我正在测试 SSH 连接以检查 git 中的 RSA 密钥.我正在处理代理服务器.我正在使用窗口 7 并安装了 msysGit-fullinstall-1.7.3.1-preview20101002.现在在 msys.exe 窗口中,我通过命令 'git config --global http.proxy http://host:port' 设置了代理之后我尝试了命令 'ssh git@github.com' .这给了我类似ssh:github.com:没有与名称相关联的地址"的错误
我该怎么办?
设置 http.proxy
不适用于 ssh.您需要代理您的 ssh 连接.请参阅此说明.总结一下:
启动 git-cmd.bat
并创建 ~/.ssh/config
(notepad %home%.sshconfig.
)
ProxyCommand/bin/connect.exe -H proxy.server.name:3128 %h %p托管 github.com用户 git端口 22主机名 github.comIdentityFile "C:usersusername.sshid_rsa"TCPKeepAlive 是身份只有是主机 ssh.github.com用户 git端口 443主机名 ssh.github.comIdentityFile "C:usersusername.sshid_rsa"TCPKeepAlive 是身份只有是
(设置正确的代理主机名:端口,以及id_rsa的路径.当你使用git-bash时,在id_rsa的路径中使用斜线)
(我的 msysgit 版本包括 connect.exe
,所以我不需要下载编译connect.c).预编译的 exe 也可用 这里.
现在 ssh github.com
应该可以工作了
注意,如果你想通过socks5代理连接,请将-H
改为-S
.
ProxyCommand connect -S proxy.server.name:1080 %h %p
如果你使用的是Linux文件系统,~/.ssh/config
的文件权限必须是600,但是在标准的NTFS windows分区上,这种权限是不存在的.>
如果您的代理需要 NTLM 身份验证,您可以使用 cntlm,另见 这个答案.
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 git@github.com' . This gives me error like 'ssh: github.com: no address associated with name'
What should i do?
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%.sshconfig.
)
ProxyCommand /bin/connect.exe -H proxy.server.name:3128 %h %p
Host github.com
User git
Port 22
Hostname github.com
IdentityFile "C:usersusername.sshid_rsa"
TCPKeepAlive yes
IdentitiesOnly yes
Host ssh.github.com
User git
Port 443
Hostname ssh.github.com
IdentityFile "C:usersusername.sshid_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.
这篇关于在 Windows 7 上的代理后面的 git 中的 SSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!