使用ssh连接git仓库!
创建密钥对
1 | ssh-keygen -t rsa -b 4096 -C "[email protected]" |
添加公钥到GitHub
公钥文件为”~/.ssh/id_rsa.pub”,添加到GitHub

测试ssh连接
1 | ssh -T [email protected] |
显示如下类似输出则可以连接上
1 | Hi 你的用户名! You've successfully authenticated, but GitHub does not provide shell access. |
如果无法连接,也可以尝试443端口连接
1 | ssh -T -p 443 [email protected] |
如果443端口可以连接,那么修改”~/.ssh/config”文件,添加下列内容,以后就默认是443端口连接了
1 | Host github.com |