如何用SSH克隆GitHub项目

诸神缄默不语-个人CSDN博文目录

使用场景:由于不可知的网络问题,无法用HTTPS克隆GitHub项目。

报错fatal: unable to access 'https://github.com/PolarisRisingWar/llm-throught-ages.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.

解决方案:改用SSH克隆

步骤一:
在本地创建public key

参考资料:https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=linux

Linux系统,运行命令:ssh-keygen -t ed25519 -C "[email protected]"

在储存public key的位置(默认是.ssh/id_ed25519.pub)得到public key

步骤二:
在GitHub设置中新增SSH Key:https://github.com/settings/keys

随便起个名字,然后将public key输入即可

步骤三:
用SSH克隆GitHub项目

复制GitHub项目的SSH URL:
在这里插入图片描述

在本地运行git clone ssh_url即可

猜你喜欢

转载自blog.csdn.net/PolarisRisingWar/article/details/132713802
今日推荐