gpt4 book ai didi

验证连接时 git 权限被拒绝(公钥)

转载 作者:太空狗 更新时间:2023-10-29 13:53:05 24 4
gpt4 key购买 nike

尝试执行以下操作时出现主题错误

$ ssh -T git@github.com
Permission denied (publickey).

.ssh权限

$ ls -al
total 33
drwxr-xr-x+ 1 MyUser AGL+Group(513) 0 Feb 27 16:53 .
drwxrwxrwt+ 1 MyUser AGL+Group(513) 0 Jan 10 16:12 ..
-rw------- 1 MyUser AGL+Group(513) 1667 Feb 28 18:01 .bash_history
-rwxr-xr-x 1 MyUser AGL+Group(513) 1494 Jan 9 20:45 .bash_profile
-rwxr-xr-x 1 MyUser AGL+Group(513) 6054 Jan 9 20:45 .bashrc
-rw-r--r-- 1 MyUser AGL+Group(513) 55 Feb 27 16:37 .gitconfig
-rwxr-xr-x 1 MyUser AGL+Group(513) 1919 Jan 9 20:45 .inputrc
-rwxr-xr-x 1 MyUser AGL+Group(513) 1236 Jan 9 20:45 .profile
drwx------+ 1 MyUser AGL+Group(513) 0 Feb 28 17:46 .ssh

我之前做了以下步骤

  1. 生成 ssh key 并存储在 .ssh 文件夹中
  2. 检查ssh代理

    $ ps aux |grep ssh<br/>
    7236 1 7236 7236 ? 1138370 18:26:09 /usr/bin/ssh-agent

  3. 通过设置将公钥 id_dsa.pub 添加到 github 帐户

MyUser@PC000009416062 ~/.ssh
$ ssh -v -T git@github.com
OpenSSH_7.1p2, OpenSSL 1.0.2f 28 Jan 2016
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to github.com [192.30.252.129] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/MyUser/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MyUser/.ssh/id_rsa-cert type -1
debug1: identity file /home/MyUser/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /home/MyUser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MyUser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MyUser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MyUser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/MyUser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/MyUser/.ssh/known_hosts:2
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/MyUser/.ssh/id_rsa
debug1: Skipping ssh-dss key /home/MyUser/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes
debug1: Trying private key: /home/MyUser/.ssh/id_ecdsa
debug1: Trying private key: /home/MyUser/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

我也尝试在这个论坛中遵循一些解决方案,但没有成功。我正在使用 Cygwin做这个

Solution 1

Solution 2

最佳答案

debug1: Skipping ssh-dss key /home/MyUser/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes

您生成了 dsa key ,默认情况下不支持该 key 。你需要添加

PubkeyAcceptedKeyTypes +ssh-dss

进入您的 ~/.ssh/config,或者生成标准的 RSA key ,它可以正常工作。

关于验证连接时 git 权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35680020/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com