前提・実現したいこと
GitHubにSSHで ssh -T git@github.comコマンドを使用して接続しようとしたとことエラーがでて接続できませんでした。おそらくですが、GitHubに接続する際に使用しているキーが違うと思います。もしそうであった場合は使用キーの変更方法を教えて頂きたいです。よろしくお願いいたします
発生している問題・エラーメッセージ
キーを作成してGitHubに接続しようとすると以下のメッセージが表示されます
git@github.com: Permission denied (publickey).
該当のソースコード
config
1Host github 2 HostName github.com 3 IdentityFile ~/.ssh/id_rsa_github 4 User git
デバッグ情報 ssh -vT git@github.comでデバッグ
UYserName@Mac-Pro .ssh % ssh -vT git@github.com OpenSSH_8.1p1, LibreSSL 2.7.3 debug1: Reading configuration data /Users/UserName/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 47: Applying options for * debug1: Connecting to github.com port 22. debug1: Connection established. debug1: identity file /Users/UserName/.ssh/id_rsa type -1 debug1: identity file /Users/UserName/.ssh/id_rsa-cert type -1 debug1: identity file /Users/UserName/.ssh/id_dsa type -1 debug1: identity file /Users/UserName/.ssh/id_dsa-cert type -1 debug1: identity file /Users/UserName/.ssh/id_ecdsa type -1 debug1: identity file /Users/UserName/.ssh/id_ecdsa-cert type -1 debug1: identity file /Users/UserName/.ssh/id_ed25519 type 3 debug1: identity file /Users/UserName/.ssh/id_ed25519-cert type -1 debug1: identity file /Users/UserName/.ssh/id_xmss type -1 debug1: identity file /Users/UserName/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_8.1 debug1: Remote protocol version 2.0, remote software version babeld-8b756cb2 debug1: no match: babeld-8b756cb2 debug1: Authenticating to github.com:22 as 'git' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: - debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ssh-rsa - debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /Users/UserName/.ssh/known_hosts:4 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 134217728 blocks debug1: Will attempt key: /Users/UserName/.ssh/id_rsa debug1: Will attempt key: /Users/UserName/.ssh/id_dsa debug1: Will attempt key: /Users/UserName/.ssh/id_ecdsa debug1: Will attempt key: /Users/UserName/.ssh/id_ed25519 ED25519 SHA256:- debug1: Will attempt key: /Users/UserName/.ssh/id_xmss debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /Users/UserName/.ssh/id_rsa debug1: Trying private key: /Users/UserName/.ssh/id_dsa debug1: Trying private key: /Users/UserName/.ssh/id_ecdsa debug1: Offering public key: /Users/UserName/.ssh/id_ed25519 ED25519 SHA256:- debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/UserName/.ssh/id_xmss debug1: No more authentication methods to try. git@github.com: Permission denied (publickey).
試したこと
・GitHuibでキーの貼り直し、確認
・configファイルの作成、記述
・known_hostsのfingerprint情報の削除
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。