英文:
SSH Permission Denied and Different Fingerprint Generated in Terminal compared to in Gitlab SSH Key
问题
目前我在使用SSH克隆存储库时遇到问题。我已经设置了我的SSH密钥并将其插入到GitLab中。然而,仍然无法正常工作。
另一个问题是上面生成的指纹与GitLab中生成的指纹不同,如下所示:
希望有人能够帮助。我已经为此烦恼了几天。
我尝试删除.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:
And another problem is the fingerprint generated above is different from the one that is generated in Gitlab as shown below:
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 <username@server>
, ssh <username@server>
, ssh -Tv <username@server>
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论