通过ssh连接GitHub 解决git clone失败 unable to access ‘https:github.com‘

我们在使用git clone项目时候经常会 clone失败 fatal: unable to access https:githubxxxxxxxx.git: Failed to connect to 127.0.0.1 port

我们在使用git clone项目时候经常会 clone失败

fatal: unable to access 'https://github/xxxx/xxxx.git': Failed to connect to 127.0.0.1 port 8087: Connection refused
或是 fatal: unable to access 'https://github/zhayujie/chatgpt-on-wechat.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.

解决办法:

通过ssh连接GitHub

1. Linux安装ssh

sudo apt-get install ssh


ssh-keygen 会确认密钥的存储位置和文件名(默认是 .ssh/id_rsa),然后全部回车即可。

2. 创建秘钥文件

ssh-keygen -t rsa -C "你的github账号邮箱"

再点击三次回车键

3.将公钥添加到GitHub账户

(1)将id_rsa.pub文件内容全部复制;

(2)登陆到GitHub上,右上角小头像->Setting->SSH and GPG keys中,点击new SSH key。

4. ssh测试

ssh -T git@github
结果为:,表示配置成功。

5.重新git clone

发布者:admin,转转请注明出处:http://www.yc00.com/web/1740418116a4241136.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信