在Ubuntu 24中,当克隆github某个项目时:
git clone https://github.com/foo/repo.git
如果提示:
gnutls_handshake() failed: The TLS connection was non-properly terminated.
这一般是由于没有通过SSH进行连接。下面是一个比较简便的解决方法。
1、生成SSH key
ssh-keygen -t ed25519 -C "your_email@example.com"
ed25519是一个加密算法,这里推荐使用该算法。
运行该命令后,会提示public key文件保存的位置,以及key的密码。直接回车使用默认值即可。
2、查看key内容
cat ~/.ssh/id_ed25519.pub
复制key内容。
3、将key粘贴到github
打开github网站,在GitHub Settings -> SSH and GPG keys -> New SSH Key 中,粘贴key。
此时再次执行 git clone 命令,应该就能正常运行了。
2万+

被折叠的 条评论
为什么被折叠?



