Не удается отправить sh на github с SourceTree, несмотря на то, что в агенте добавлена ​​идентификация: Отказано в доступе (publickey) - PullRequest
1 голос
/ 18 февраля 2020

Если я запускаю ssh-add -l, я вижу свою личность в списке, как и ожидалось. Если я запускаю ssh -vT git@github.com, я получаю такой вывод:

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/myself/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to github.com [140.82.113.4] port 22.
debug1: Connection established.
debug1: identity file /Users/myself/.ssh/id_rsa type -1
debug1: identity file /Users/myself/.ssh/id_rsa-cert type -1
debug1: identity file /Users/myself/.ssh/id_dsa type -1
debug1: identity file /Users/myself/.ssh/id_dsa-cert type -1
debug1: identity file /Users/myself/.ssh/id_ecdsa type -1
debug1: identity file /Users/myself/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/myself/.ssh/id_ed25519 type -1
debug1: identity file /Users/myself/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/myself/.ssh/id_xmss type -1
debug1: identity file /Users/myself/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version babeld-849b9b5f
debug1: no match: babeld-849b9b5f
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: rsa-sha2-512
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 SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/myself/.ssh/known_hosts:1
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: Will attempt key: Generated by Sourcetree on macOS for myself-GitHub RSA SHA256:WnUQPEasG3tUVyEkE7Ufo9fGoRqCdUeY9ohZ7OU6fsc agent
debug1: Will attempt key: /Users/myself/.ssh/id_rsa
debug1: Will attempt key: /Users/myself/.ssh/id_dsa
debug1: Will attempt key: /Users/myself/.ssh/id_ecdsa
debug1: Will attempt key: /Users/myself/.ssh/id_ed25519
debug1: Will attempt key: /Users/myself/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: Generated by Sourcetree on macOS for myself-GitHub RSA SHA256:WnUQPEasG3tUVyEkE7Ufo9fGoRqCdUeY9ohZ7OU6fsc agent
debug1: Server accepts key: Generated by Sourcetree on macOS for myself-GitHub RSA SHA256:WnUQPEasG3tUVyEkE7Ufo9fGoRqCdUeY9ohZ7OU6fsc agent
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([140.82.113.4]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_TERMINAL_VERSION = 3.3.8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_TERMINAL = iTerm2
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi myself! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3564, received 2484 bytes, in 0.2 seconds
Bytes per second: sent 18846.5, received 13135.4
debug1: Exit status 1

Я все еще не могу записать код sh на github, несмотря на получение сообщения You've successfully authenticated в этом отладочном выводе, идентификатор S SH генерируемый самим SourceTree и обеспечивающий работу моего агента S SH, выполнив eval "$(ssh-agent)".

. Я также вижу ожидаемый ключ в своем профиле github.

Что здесь не так?

1 Ответ

1 голос
/ 18 февраля 2020

Мой S SH Агент работает, выполнив eval "$ (s sh -agent)".

Вероятно, это проблема. ssh знает, как общаться с ssh-agent через переменные окружения SSH_AUTH_SOCK. Переменные среды видны только процессу и его дочерним элементам.

eval "$(ssh-agent)" устанавливает SSH_AUTH_SOCK только для этой оболочки и ее дочерних элементов ; это все, что вы убежали из этой оболочки. Если вы затем запустите git в этой оболочке, она должна работать. Но если у вас есть какая-то отдельная программа, не запущенная из этой оболочки, например, Atlassian Sourcetree, когда она запускает s sh, она не будет знать, что говорить с этим s sh -агентом.

Вы можете запустить Sourcetree из этой оболочки, но это не очень хорошее решение.

Чтобы исправить это и множество других проблем, связанных с s sh, запустите агент s sh при входе в систему. Это должно быть сделано для вас вашей операционной системой, или, если не следовать инструкциям для вашей операционной системы. В противном случае следуйте советам в различных ответах здесь .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...