用pycharm向github库push总是失败?快使用ssh!

git bash:移动到项目目录下

查看clone 地址:git remote -v

移除现有远程库方式:git remote rm origin

添加新的git方式:git remote add origin [github的ssh地址]

查看push方式是否修改成功:git remote -v

 push:git push origin master(或者使用pycharm的push)

 

 

# 问题: ssh: connect to host github.com port 22: Connection timed !

解决方法:

1、检查SSH是否能连接成功:ssh -T git@github.com

2、vim config

3、输入:

Host github.com

User 【YourEmail】

Hostname ssh.github.com

PreferredAuthentications publickey 

IdentityFile ~/.ssh/id_rsa

Port 443

4、:wq (保存退出)

5、ssh -T git@github.com(在弹出的提示后回车“yes”)

参考:https://blog.csdn.net/qq_42146613/article/details/82772734

posted on 2021-12-13 00:21  crazyplayer  阅读(1362)  评论(0)    收藏  举报

导航