尝试执行以下操作时出现主题错误
$ ssh -T [email protected]
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
在此之前我做了以下步骤
$ ps aux |grep ssh
7236 1 7236 7236 ? 1138370 18:26:09 /usr/bin/ssh-agent
MyUser@PC000009416062 ~/.ssh $ ssh -v -T [email protected] 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 [email protected] <implicit> none debug1: kex: client->server [email protected] <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
最佳答案
您生成了 dsa
key ,默认情况下不支持该 key 。你需要添加
PubkeyAcceptedKeyTypes +ssh-dss
进入您的
~/.ssh/config
,或者生成标准 RSA key ,这些 key 可以正常工作。关于验证连接时 git 权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35680020/