尝试使用自定义密钥文件连接到github时,权限被拒绝(publickey)

尝试使用自定义密钥文件连接到github时,权限被拒绝(publickey),github,ssh-keys,Github,Ssh Keys,我已使用以下内容创建了~/.ssh/config文件: Host github.com-xxx HostName github.com User git IdentityFile ~/.ssh/id_rsa_xxx 当我运行ssh github.com xxx时,我得到一个错误: Permission denied (publickey). (我还为其他服务器定义了其他~/.ssh/id\u rsa文件。) 当我添加-v时,日志如下所示: OpenSSH_6.9p1, L

我已使用以下内容创建了
~/.ssh/config
文件:

Host github.com-xxx
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_xxx
当我运行
ssh github.com xxx
时,我得到一个错误:

Permission denied (publickey).
(我还为其他服务器定义了其他
~/.ssh/id\u rsa
文件。)

当我添加
-v
时,日志如下所示:

    OpenSSH_6.9p1, LibreSSL 2.1.8
    debug1: Reading configuration data /Users/xxx/.ssh/config
    debug1: /Users/xxx/.ssh/config line 17: Applying options for github.com-xxx
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 21: Applying options for *
    debug1: Connecting to github.com [192.30.253.113] port 22.
    debug1: Connection established.
    debug1: identity file /Users/xxx/.ssh/id_rsa_xxx type 1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/xxx/.ssh/id_rsa_xxx-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_6.9
    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:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    debug1: Host 'github.com' is known and matches the RSA host key.
    debug1: Found key in /Users/xxx/.ssh/known_hosts:1
    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: Offering RSA public key: /Users/xxx/.ssh/id_rsa_xxx
    debug1: Authentications that can continue: publickey
    debug1: No more authentication methods to try.
    Permission denied (publickey).

OTHER\u USER
是我创建的
~/.ssh/id\u rsa
文件的用户。

是的,只是为了测试,如果因为我正在尝试设置~/.ssh/config文件,但我失败了为什么?我可以成功地为其他用户进行ssh-请参阅编辑后的问题。这是测试与github的ssh连接的方法:
Hi OTHER_USER! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.