We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在本机编写的项目,时不时地就因为众所周知的原因无法推送到 GitHub 上了。既然阳关大道走不通,那就只好走独木桥了。
本机的项目往 GitHub 推送失败时,会报下面的错误:
ssh: connect to host github.com port 22: Connection timed out
用上面的报错信息 Google,看到 Stack Overflow 上有解决方法:git - ssh: connect to host github.com port 22: Connection timed out | Stack Overflow。
上面的修改只是让本机项目走 http 协议,还要让项目走本地代理才行,设置方式参考:laispace/git 设置和取消代理。
在终端先用指令 ssh -T git@github.com 测试是否能通过 ssh 连接到 GitHub 上,如果提示连接超时,说明 ssh 的确连不到 GitHub 上。
ssh -T git@github.com
ssh 不行,那就换 http 方式。在项目所在目录中,执行 git config --local -e,会显示当前项目的 git 设置,把 ssh 方式的 URL:url = git@github.com:username/repo.git 改成 http 方式的 URL:url = https://github.com/username/repo.git。
git config --local -e
url = git@github.com:username/repo.git
url = https://github.com/username/repo.git
然后!不要忘了然后,还要让 git 走本地代理。当然了,http.proxy 和 https.proxy 后面究竟是用 socks5 还是 http,都要看代理软件的设置,根据自己的实际情况来就行。
http.proxy
https.proxy
socks5
http
$ git config --global https.proxy 'socks5://127.0.0.1:1080' $ git config --global http.proxy 'socks5://127.0.0.1:1080'
Google + Stack Overflow 解决程序员所有问题 😄
The text was updated successfully, but these errors were encountered:
No branches or pull requests
需求描述
在本机编写的项目,时不时地就因为众所周知的原因无法推送到 GitHub 上了。既然阳关大道走不通,那就只好走独木桥了。
方案调研
调研过程
本机的项目往 GitHub 推送失败时,会报下面的错误:
用上面的报错信息 Google,看到 Stack Overflow 上有解决方法:git - ssh: connect to host github.com port 22: Connection timed out | Stack Overflow。
上面的修改只是让本机项目走 http 协议,还要让项目走本地代理才行,设置方式参考:laispace/git 设置和取消代理。
入选方案
应用过程
在终端先用指令
ssh -T git@github.com
测试是否能通过 ssh 连接到 GitHub 上,如果提示连接超时,说明 ssh 的确连不到 GitHub 上。ssh 不行,那就换 http 方式。在项目所在目录中,执行
git config --local -e
,会显示当前项目的 git 设置,把 ssh 方式的 URL:url = git@github.com:username/repo.git
改成 http 方式的 URL:url = https://github.com/username/repo.git
。然后!不要忘了然后,还要让 git 走本地代理。当然了,
http.proxy
和https.proxy
后面究竟是用socks5
还是http
,都要看代理软件的设置,根据自己的实际情况来就行。要点总结
Google + Stack Overflow 解决程序员所有问题 😄
The text was updated successfully, but these errors were encountered: