[英]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%\\.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
(设置正确的代理主机名:端口,以及 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分区上,这种权限是不存在的。
您的代理是否需要密码? 那么可能就是这样。
export http_proxy="http://<domain>\\<username>:<password>@<server>:<port>"
请参阅:如何通过 HTTP 代理从 Git 存储库中提取? (复制!)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.