Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GitLab SSH权限被拒绝(公钥)_Git_Macos_Ssh_Gitlab - Fatal编程技术网

GitLab SSH权限被拒绝(公钥)

GitLab SSH权限被拒绝(公钥),git,macos,ssh,gitlab,Git,Macos,Ssh,Gitlab,我已经按照Gitlab的说明设置了SSH密钥 完成所有操作后,我使用 ssh -T git@gitlab.com 但后来我的电脑出了一个错误 git@gitlab.com: Permission denied (public key). 我还尝试了ssh-tvvgit@gitlab.com查找问题,如下所示。 但我不知道如何修复它,有人有想法吗,或者可以分享建议吗? 多谢各位 OpenSSH_8.1p1, LibreSSL 2.7.3 ....... debug3: send packet:

我已经按照Gitlab的说明设置了SSH密钥

完成所有操作后,我使用

ssh -T git@gitlab.com
但后来我的电脑出了一个错误

git@gitlab.com: Permission denied (public key).
我还尝试了
ssh-tvvgit@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).
感谢您耐心阅读我的帖子

使用id_ed25519.pub密钥进行设置,并将其存储在/Users/brandon/.ssh中

首先尝试使用更经典的rsa密钥进行测试

ssh-keygen -t rsa -P "" -m PEM 
将/Users/brandon/.ssh/id_rsa.pub复制到您的GitLab ssh帐户设置中,并检查是否
ssh-Tgit@gitlab.com
有效。

谢谢,我解决了! 因为它的服务器是我们学校的,所以更换后
ssh-Tgit@gitlab.com
to
ssh-Tgit@theuniversitylink.com
它可以工作


我非常感谢所有的分享和帮助。

我在macos上这样做:

ssh-add ~/.ssh/id_ed25519.pub

您可以运行ls-lh~/.ssh/来查看您的ssh密钥对吗?从ssh日志中,它使用
/Users/brandon/.ssh/id_ed25519
向Gitlab进行身份验证。这与您使用的SSH公钥相同吗?SSH应该使用哪个文件向github进行身份验证?换句话说,您使用github设置了什么键?那把钥匙存储在哪个文件里?@AlekseyTsalolikhin它表示总共24-rw----1名布兰登员工419B 5 7 02:16 id_ed25519-rw-r--r--1名布兰登员工108B 5 7 02:16 id_ed25519.pub-rw-r--r--1名布兰登员工186B 5 7 02:17已知_hosts@GinoMempin是的,但我不知道为什么它不起作用:(嗨,谢谢!我试过了,但是公钥的结果还是一样的(拒绝)@BrandonTW你是否正确地将
id\u rsa.pub
的内容注册到你的帐户?作为一条连续的线?a
ssh-Tv
是否显示id\u rsa是否被接受?或者
id\u ed25519
?@VonC是的!