Github-git push 超时

来源:互联网 发布:数据结构考研算法 编辑:程序博客网 时间:2024/05/21 08:49

好久没用Git,手生的不行。今天使用的时候发现git push没用了。
等了很久结果说是超时。

刚开始我以为是SSH设置的问题,所以找了一大堆攻略关于SSH设置。
1.SSH如何免密码登陆
比如 http://blog.csdn.net/leexide/article/details/17252369
然而并没有什么卵用,因为问题不是这个

我发现我电脑并不能够翻墙,用浏览器上 Github也上不去。会不会是不能翻墙的原因呢?GFW不有又升级了吧!
2.如何使用Shadowsocks进行翻墙
https://rosing.gitbooks.io/pythoncamp0/content/wiki/shadowsocks.html
现在已经可以翻墙。But忽然想到一个问题!用浏览器可以轻松的翻墙,终端可以翻墙么?结果是不行的,所以需要使用一些方法来让终端也可以翻墙
3.终端如何使用shadowsocks进行代理
http://www.linuxdiyf.com/linux/17144.html
这样设置以后确实可以在终端上实现翻墙。
但是再当我按下Enter的时候。结果还是一样 Time out

最后就在绝望的时候,再网上突然发现一篇文章《改用 443 端口连接 Github 修复 git push 时出现 Connection timed out 的问题》
就是这篇文章解决我的问题。

4.改用443端口,解决Github-git push超时
修改 ~/.ssh/config 中 github.com 的配置, Hostname 改为 ssh.github.com, Port 改为 443:

Host github.comHostname ssh.github.comPort 443

测试:

$ ssh -T git@github.comWarning: Permanently added '[ssh.github.com]:443,[192.30.252.148]:443' (RSA) to the list of known hosts.Hi mozillazg! You've successfully authenticated, but GitHub does not provide shell access.$ git pushWarning: Permanently added '[ssh.github.com]:443,[192.30.252.151]:443' (RSA) to the list of known hosts.

终于可以使用了!!!!!我的天!
真是不容易啊

这里有别人总结好,关于Github基本使用步骤和常见问题及其解决方案。
https://segmentfault.com/a/1190000004317077

0 0