SSH权限被拒绝,终端生成的指纹与Gitlab SSH密钥中的指纹不同

huangapple go评论56阅读模式
英文:

SSH Permission Denied and Different Fingerprint Generated in Terminal compared to in Gitlab SSH Key

问题

目前我在使用SSH克隆存储库时遇到问题。我已经设置了我的SSH密钥并将其插入到GitLab中。然而,仍然无法正常工作。

权限被拒绝,就像下面这样:
SSH权限被拒绝,终端生成的指纹与Gitlab SSH密钥中的指纹不同

另一个问题是上面生成的指纹与GitLab中生成的指纹不同,如下所示:
SSH权限被拒绝,终端生成的指纹与Gitlab SSH密钥中的指纹不同

希望有人能够帮助。我已经为此烦恼了几天。

我尝试删除.ssh文件夹,生成新的密钥,然后再次执行相同的操作,但结果相同,权限被拒绝,指纹不匹配。

我正在使用OpenSSH和操作系统:Windows 11来解决这个问题。我还尝试了ssh -Tvvv <username@server>ssh <username@server>ssh -Tv <username@server>来验证是否已连接,但权限仍然被拒绝。

英文:

Currently I am facing a problem with git clone a repo using SSH. I had set up my SSH Key and inserted it into GitLab. However still it does not work out.

Permission denied as like below:
SSH权限被拒绝,终端生成的指纹与Gitlab SSH密钥中的指纹不同

And another problem is the fingerprint generated above is different from the one that is generated in Gitlab as shown below:
SSH权限被拒绝,终端生成的指纹与Gitlab SSH密钥中的指纹不同

Hope if anyone could help. Had been troubleshooting this for a few days.

I tried to delete the .ssh folder and regenerate new key and did everything the same again but turn out to be the same, Permission denied and fingerprint is never matching.

I am using OpenSSH and OS: Windows 11 for this problem. I had also tried ssh -Tvvv &lt;username@server&gt; , ssh &lt;username@server&gt;, ssh -Tv &lt;username@server&gt; to verify whether if I am connected but the same permission denied.

答案1

得分: 1

根据注释,服务器指纹(对于~/.ssh/known_hosts)与公钥指纹不同。

对于公钥指纹,请使用 ssh -Tv git@gitlab.com 进行测试,并检查是否使用了您的私钥。

如果您的私钥没有默认名称(如 id_rsa),您需要在 ~/.ssh/config 中引用您的密钥。

Host gl
  Hostname gitlab.com
  User git
  IdentityFile ~/.ssh/myKey

然后使用 ssh -Tv gl 进行测试。

英文:

As commented, the server fingerprint (for the ~/.ssh/known_hosts) differs from the public key fingerprint.

For the latter, test it with ssh -Tv git@gitlab.com, and check your private key is used.

If your private key does not have a default name (like id_rsa), you would need a ~/.ssh/config to reference your key.

Host gl
  Hostname gitlab.com
  User git
  IdentityFile ~/.ssh/myKey

And ssh -Tv gl for testing.

huangapple
  • 本文由 发表于 2023年2月19日 03:31:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75495884.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定