小编典典

与 github 同步

git

这是我第 n 次尝试连接到我的 github 帐户,并且对我未能做到这一点变得越来越沮丧。

我在 Windows 上一步一步地按照本教程进行Github 设置,但在第 5 步失败,即测试所有内容。

ssh git@github.com

给我这个

ssh: github.com: no address associated with name

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

我正在使用 Windows XP 上的 railsinstaller 附带的默认 git 安装(在代理之后)


阅读 153

收藏
2022-06-11

共1个答案

小编典典

您至少需要设置一个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 询问您的密码,请在您的(或for bash 会话)中创建一个_netrc文件HOME``.netrc

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

请注意,自 git1.7.10 (2012) 以来,您可以使用凭证缓存机制以避免必须以纯文本形式存储您的登录名/密码(在%HOME%/_netrc文件中)。

2022-06-11