简体   繁体   English

GitLab SSH 权限被拒绝(公钥)

[英]GitLab SSH Permission denied (publickey)

I've followed the Gitlab instructions to set up an SSH key.我按照 Gitlab 说明设置了 SSH 密钥。

After everything is completed, I test my settings with一切都完成后,我测试我的设置

ssh -T git@gitlab.com

but then I got an error with但后来我遇到了一个错误

git@gitlab.com: Permission denied (public key).

I also tried ssh -Tvvv git@gitlab.com to find out the problems, as below.我还尝试ssh -Tvvv git@gitlab.com出问题,如下所示。 But I can't figure out how to fix it, does anybody have an idea, or could share suggestions?但我不知道如何解决它,有没有人有想法,或者可以分享建议? Thank you very much!非常感谢!

OpenSSH_8.1p1, LibreSSL 2.7.3
.......
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/brandon/.ssh/id_rsa
debug3: no such identity: /Users/brandon/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /Users/brandon/.ssh/id_dsa
debug3: no such identity: /Users/brandon/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /Users/brandon/.ssh/id_ecdsa
debug3: no such identity: /Users/brandon/.ssh/id_ecdsa: No such file or directory
debug1: Offering public key: /Users/brandon/.ssh/id_ed25519 ED25519 SHA256:uOKjKpgEmnKqrFAS05Ccy8+B3Uw0kzSpurUpOgH0l3k
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/brandon/.ssh/id_xmss
debug3: no such identity: /Users/brandon/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
git@gitlab.com: Permission denied (publickey).

Thank you for your patience in reading my post.感谢您耐心阅读我的帖子。

Thank you, I solved it!谢谢,我解决了! Since its server is from our university so after changing ssh -T git@gitlab.com to ssh -T git@theuniversitylink.com it works. Since its server is from our university so after changing ssh -T git@gitlab.com to ssh -T git@theuniversitylink.com it works.

I appreciate a lot for all the sharing and helps.我非常感谢所有的分享和帮助。

set up with id_ed25519.pub key, and it stored in /Users/brandon/.ssh使用 id_ed25519.pub 密钥设置,并将其存储在 /Users/brandon/.ssh

Try first with a more classic rsa key, for testing!首先尝试使用更经典的 rsa 密钥进行测试!

ssh-keygen -t rsa -P "" -m PEM 

Copy the /Users/brandon/.ssh/id_rsa.pub to your GitLab SSH account settings, and check if ssh -T git@gitlab.com works. Copy the /Users/brandon/.ssh/id_rsa.pub to your GitLab SSH account settings, and check if ssh -T git@gitlab.com works.

I fixed it this way on macos:我在macos上以这种方式修复了它:

ssh-add ~/.ssh/id_ed25519.pub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM