我知道类似的问题已经被问过很多次了,但这里有一个不同:
试图从cpanel共享托管服务器克隆项目:
如果尝试使用此命令sudo git clone ssh://mlbrpkxs@mlbranch.com:21098/home/mlbrpkxs/unified.mlbranch.com
它显示如下错误:
Cloning into 'unified.mlbranch.com'...
Unable to negotiate with 63.250.38.32 port 21098: no matching host key type found. Their offer: ssh-rsa,ssh-dss
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
如果在这里找到一个解决方案,并尝试使用此命令进行克隆。
sudo GIT_SSH_COMMAND="ssh -oHostKeyAlgorithms=+ssh-dss" git clone ssh://mlbrpkxs@mlbranch.com:21098/home/mlbrpkxs/unified.mlbranch.com
Cloning into 'unified.mlbranch.com'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the DSA key sent by the remote host is
SHA256:hSIV2UEWbLuZQu2gkNaYNYxfmOd59VGlaNwXI85P+fA.
Please contact your system administrator.
Add correct host key in /var/root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /var/root/.ssh/known_hosts:1
Host key for [mlbranch.com]:21098 has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
我发现最相关的问题在这里,它被关闭为这个问题的副本,而这个问题本身被关闭为离题。但它们是不一样的。这里还有一个相关的问题。
在大多数情况下,我们知道,您可以通过替换服务器密钥来解决问题,例如通过运行:
ssh-keygen -R <host>
在我的例子中:
ssh-keygen -R "[mlbranch.com]:21098"
但是无论是这个解决方案,还是从文件~/.ssh/known_hosts
中删除违规密钥都没有解决我的问题。
我已经清理了所有由stackOver flow的答案推荐的known_hosts。现在我完全卡住了,无法找到任何解决方案,我该如何解决这个问题。
请注意,我使用的是Mac book,我的代码是在使用Cpanel的共享主机上。在我的其他Mac上,我可以得到克隆。
先检查你的私钥在哪里
如果它在/home/aUser/.ssh
中,那么sudo xxx
将完全忽略它。
如果必须使用root
,则需要sudo ssh -i /home/aUser/.ssh/myPrivateKey mlbrpkxs@mlbranch.com:21098
。
与Git:
sudo "GIT_SSH_COMMAND="ssh -oHostKeyAlgorithms=+ssh-dss -i /home/aUser/.ssh/myPrivateKey" git clone ssh://mlbrpkxs@mlbranch.com:21098/home/mlbrpkxs/unified.mlbranch.com
sudo
。
Github最近刚刚更新了RSA SSH主机密钥!
在3月24日大约05:00 UTC,出于谨慎,我们替换了用于保护GitHub.com Git操作的RSA SSH主机密钥。
要解决这个问题,只需将新的RSA SSH主机密钥添加到.ssh/known_hosts
文件。
通过运行以下命令删除旧密钥:
$ ssh-keygen -R github.com
并添加到文件.ssh/known_hosts
echo "github.com ssh-rsa <OMITTED KEY>" >> ~/.ssh/known_hosts
如果您喜欢手动操作
github.com ssh-ed25519 <OMITTED KEY>
github.com ssh-rsa <OMITTED KEY>
如果其他不需要,则仅此。
github.com ssh-rsa <OMITTED KEY>
源代码中的键:https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints