2011-03-21 134 views
12

这是第n次尝试连接到我的github帐户,并且在我未能完成此操作时变得越来越沮丧。与github同步

我按照这个教程步骤Github setup on windows但我在第5步失败,即测试一切。

ssh [email protected] 

给了我这个

ssh: github.com: no address associated with name 

任何想法有什么不好?任何帮助将不胜感激。

我使用它自带的railsinstaller在Windows XP(代理服务器后面)

回答

16

您至少需要设置一个HTTP_PROXY变量环境。

set HTTPS_PROXY=http://<login_internet>:<password_internet>@aproxy:aport 
set HTTP_PROXY=http://<login_internet>:<password_internet>@aproxy:aport 

或者,bash命令:

export http_proxy=http://<login_internet>:<password_internet>@aproxy:aport 
export https_proxy=http://<login_internet>:<password_internet>@aproxy:aport 

确保%HOME%(或$ HOME)设置到你做存储您.ssh配置

然后,Git命令目录:

git config --system http.sslcainfo \\bin\\curl-ca-bundle.crt 
git config --global http.proxy http://<login_internet>:<password_internet>@aproxy:aport 
git config --global user.name <short_username> 
git config --global user.email <email> 
git config --global github.user <github_username> 
git config --global github.token <github_token> 

注:bash命令:

git config --system http.sslcainfo /bin/curl-ca-bundle.crt 

为了避免GitHub的询问您的密码,在你的HOME(或对于bash会话的.netrc)创建_netrc文件

machine github.com 
login <login_github> 
password <password_github> 

更新2012

注意since git1.7.10(2012 ),您可以使用credential caching mechanism以避免以纯文本形式存储您的登录名/密码(在%HOME%/_netrc文件中)。

+0

如果你有关于\\ bin \\ curl-ca-bundle.crt的错误,你可以使用:git config --global http.sslverify“false” – DarkteK 2016-07-20 18:51:59

+0

@GonzaloJarjury这不是我会推荐的做法。始终尝试验证您的证书。首先尝试,即使在最新版本的Git的Windows上:'git config --system http.sslcainfo/ssl/certs/ca-bundle.crt' – VonC 2016-07-20 18:54:59

0

如果你使用代理服务器,你也防火墙后面的默认安装的git?请尝试运行ssh -v [email protected]以查看幕后发生了什么。对于我的设置,我的~/.ssh/config看起来是这样的:

Host github.com 
ProxyCommand /c/windows/connect.exe -H name_of_proxy:8080 %h %p 
User git 
Port 443 
Hostname ssh.github.com 
TCPKeepAlive yes 
IdentitiesOnly yes 

的ProxyCommand描述here

+0

是的,我在防火墙后面。但是,我使用的代理是脚本而不是静态地址。我怎样才能在配置文件中考虑到这一点? – Prakhar 2011-03-21 13:10:27

+0

剧本是做什么的? – jhwist 2011-03-21 13:46:58

1

对于那些没有启用代理并且问题仍然存在的人,我找到了解决方案!这是优胜美地的问题。苹果公司用discoveryd替代了mDNSResponder。这是一个服务,你可以卸载和加载回:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist 

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist 

这篇文章解释了每一个细节:

http://arstechnica.com/apple/2015/01/why-dns-in-os-x-10-10-is-broken-and-what-you-can-do-to-fix-it/

它为我!