报错内容
root@master:~/package# git clone git@git.code.tencent.com:xxx.git
Cloning into 'xxx'...
Unable to negotiate with 106.52.160.162 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
那到底有没有配置呢?
你明明配置了
但是又没有权限
走的是ssh 所以我们可以用命令看一下日志
解决过程
ssh -vT git@git.code.tencent.com
就会有很多日志输出了
根据实际日志去分析一下
我的是这个日志:
host key algorithm: (no match)
Unable to negotiate with 106.52.160.162 port 22: no matching host key type found. Their offer: ssh-rsa
算法匹配的问题
于是,我创建了~/.ssh/config文件,如果有就不用创建
写入内容:
Host git.code.tencent.com
HostKeyAlgorithms=+ssh-rsa
User git
IdentityFile ~/.ssh/id_rsa
PubkeyAcceptedKeyTypes +ssh-rsa
然后代码就可以拉下来了
PubkeyAcceptedKeyTypes +ssh-rsa
主要是算法类型