簡體   English   中英

GitLab SSH 權限被拒絕(公鑰)

[英]GitLab SSH Permission denied (publickey)

我按照 Gitlab 說明設置了 SSH 密鑰。

一切都完成后,我測試我的設置

ssh -T git@gitlab.com

但后來我遇到了一個錯誤

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

我還嘗試ssh -Tvvv git@gitlab.com出問題,如下所示。 但我不知道如何解決它,有沒有人有想法,或者可以分享建議? 非常感謝!

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).

感謝您耐心閱讀我的帖子。

謝謝,我解決了! Since its server is from our university so after changing ssh -T git@gitlab.com to ssh -T git@theuniversitylink.com it works.

我非常感謝所有的分享和幫助。

使用 id_ed25519.pub 密鑰設置,並將其存儲在 /Users/brandon/.ssh

首先嘗試使用更經典的 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.

我在macos上以這種方式修復了它:

ssh-add ~/.ssh/id_ed25519.pub

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM