Przez ostatnie kilka dni miałem problemy z połączeniem się z kontem github.
Mam:
- Postępowałem zgodnie z instrukcjami, aby wygenerować klucze i dodać do github
- Postępowano zgodnie z instrukcją rozwiązywania problemów dotyczącą Odmowy uprawnień (Mój skrót MD5 lokalnie odpowiada temu z mojego konta github).
- Próbowałem pełnego wyjścia podczas testowania połączenia ssh
Oto wynik dla ssh -vT git@github.com
OpenSSH_7.5p1, OpenSSL 1.0.2l 25 May 2017
debug1: Reading configuration data /Users/[obfuscated]/.ssh/config
debug1: /Users/[obfuscated]/.ssh/config line 13: Applying options for *
debug1: /Users/[obfuscated]/.ssh/config line 24: Applying options for github.com
debug1: Reading configuration data /usr/local/etc/ssh/ssh_config
debug1: Connecting to github.com [192.30.253.112] port 22.
debug1: fd 5 clearing O_NONBLOCK
debug1: Connection established.
debug1: identity file /Users/[obfuscated]/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/[obfuscated]/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
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: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: zlib@openssh.com
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: zlib@openssh.com
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
Coś interesującego, co zauważyłem, to to, że nie mam debug1: Offering RSA public key: /Users/you/.ssh/id_rsa
lub debug1: Trying private key: /Users/you/.ssh/id_rsa
w debugowaniu. Prawie tak, jakby ta część była pomijana. Mam debug1: identity file /Users/[obfuscated]/.ssh/id_rsa type 1
jednak, więc wygląda na to, że znalazł plik.
Oto moje .ssh/config
:
Host localhost
ControlMaster no
# default for all hosts
Host *
ConnectTimeout 30
ServerAliveInterval 30
ControlMaster auto
ControlPersist 60s
HashKnownHosts yes
GSSAPIAuthentication no
IdentitiesOnly yes
Compression yes
# github user
Host github.com
HostName github.com
User git
PreferredAuthentications publicKey
IdentityFile ~/.ssh/id_rsa
# the local raspberry pi dns ad block server
Host pi
HostName [obfuscated]
User pi
IdentityFile ~/.ssh/pi_rsa
Uprawnienia do plików ssh
8 -rw-r--r-- 1 [obfuscated] staff 802B Sep 9 21:45 config
8 -rw------- 1 [obfuscated] staff 3.2K Sep 9 21:16 id_rsa
8 -rw-r--r-- 1 [obfuscated] staff 747B Sep 9 21:16 id_rsa.pub
8 -rw-r--r-- 1 [obfuscated] staff 885B Sep 9 21:37 known_hosts
8 -rw------- 1 [obfuscated] staff 1.7K Oct 21 2016 pi_rsa
8 -rw-r--r-- 1 [obfuscated] staff 405B Oct 21 2016 pi_rsa.pub