git clone Debug
SSH debug
今天clone公司repo的时候发现有ssh key已经添加了也会报错。permission deny,当时觉得不应该,觉得是pubkey复制错了。遂在另一台archlinux的主机上也尝试了一下,依然报错。
感觉不是key错误的问题,遂开始debug。ssh链接的debug倒也简单,直接ssh -vvvv git@git.bitbucket.com
就可以看到链接的具体问题.
最后报错
1
2
debug1: send_pubkey_test: no mutual signature algorithm <-- ssh-rsa is not enabled
debug1: No more authentication methods to try.
搜了一下发现
1
2
Cause
The RSA SHA-1 hash algorithm is being quickly deprecated across operating systems and SSH clients because of various security vulnerabilities, with many of these technologies now outright denying the use of this algorithm.
For example - here is the announcement from OpenSSH regarding their upcoming deprecation of the ssh-rsa algorithm.
多半是archlinux滚的太快了,openssh更的快,放弃了RSA SHA-1的加密算法, opsnssh 8.2已经不支持ssh-rsa了,主要是这个算法有安全漏洞,所以被放弃了。
解决的方法有两种了,第一种直接在ssh的config里加上
1
PubkeyAcceptedKeyTypes +ssh-rsa
另外一种就是生成使用其他加密算法的ssh key
1
ssh-keygen -t ed25519 -C "your_email@example.com"
然后把pubkey添加到gitlab上就可以了。
另外,配置免密登录
ssh-copy-id -i ~/.ssh/id_ed25519.pub
在windows下,好像没有这个ssh-copy-id的命令,可以用
1
cat ~/.ssh/id_ed25519.pub | ssh user@hostname "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys"
简答的讲就是要把你的pubkey添加到服务器的authorized_keys文件里面。
This post is licensed under CC BY 4.0 by the author.