本地库内容推送到github远程库时出现ssh: connect to host github.com port 22: Connection timed out的解决方案...

在看廖雪峰老师的git教程的时候,遇到一个问题在git push -u origin master出现了报错

通过ssh -T git@github.com进行debug,发现如下错误

于是解除了绑定,重新进行添加:

Step1:git remote rm origin

Step2:git remote add origin https://github.com/用户名(注意这个是你github的用户名,不是本地的)/库名.git

注意:git支持多种协议,默认是git://使用ssh,但也可以使用https等其他协议

因为有些公司只开放了http端口,无法使用ssh,但可以使用https

所以在这种情况只能采用url = https://github.com/username/***.git形式,不能用url = git@github.com:username/***.git,(廖雪峰老师课程里面说的是git remote add origin git@github.com:用户名/库名.git

Step3:设置proxy:

git config --global http.proxy http://**.**.**.**: 8080 
git config --global https.proxy https://**.**.**.**: 8080 
 
Step4: git push -u origin master
 
这样就完成了将本地库内容推送到github远程库

转载于:https://www.cnblogs.com/candychen20170109/p/6385368.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值