Windows 7上的Proxy后面的git中的SSH [英] SSH in git behind proxy on windows 7

查看:66
本文介绍了Windows 7上的Proxy后面的git中的SSH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试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:没有与名称相关联的地址"之类的错误

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'

我该怎么办?

推荐答案

设置 http.proxy 不适用于ssh.您需要代理ssh连接.请参阅说明.总结一下:

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

启动 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 ,所以我没有需要下载并编译连接.c ).也可以使用预编译的exe 这里.

(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.

现在 ssh github.com 应该可以工作

请注意,如果要通过socks5代理进行连接,请将 -H 更改为 -S .

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

如果使用Linux文件系统,则〜/.ssh/config 的文件许可权必须为600,但是在标准NTFS Windows分区上,这些许可权不存在.

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.

如果您的代理服务器需要NTLM身份验证,则可以使用 cntlm ,另请参见

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

这篇关于Windows 7上的Proxy后面的git中的SSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆