尽管在代理中添加了身份,但仍无法使用SourceTree推送到github:权限被拒绝(公钥)

eComEvo

如果我跑步ssh-add -l,则可以在列表中看到我的身份。如果我运行ssh -vT [email protected]我会得到以下输出:

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: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] 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

尽管You've successfully authenticated在此调试输出中获得了消息,但仍然无法将代码推送到github ,SSH身份由SourceTree本身生成,并通过运行确保我的SSH代理正在运行eval "$(ssh-agent)"

我还可以在我的github配置文件中看到预期的密钥。

怎么了

我的SSH代理通过执行评估“ $(ssh-agent)”来运行。

这可能是问题所在。ssh知道要ssh-agent通过SSH_AUTH_SOCK环境变量进行交谈环境变量仅对流程及其子级可见。

eval "$(ssh-agent)"设置SSH_AUTH_SOCK 为仅此外壳及其子女; 那就是您从该shell运行的所有内容。如果您随后git在此shell中运行,它将正常工作。但是,如果您有一些未从此Shell启动的独立程序,例如Atlassian Sourcetree,则在运行ssh时,它将不知道与该ssh-agent进行通信。

您可以从该Shell启动Sourcetree,但这不是一个很好的解决方案。

要解决此问题以及其他许多与ssh相关的问题,请在登录时启动ssh-agent。这应该由您的操作系统来完成,或者如果没有遵循针对您的操作系统的说明。否则,请按照此处各种答案中的建议进行操作

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

基于groovy的Jenkins Pipeline:无法推送到git:权限被拒绝(公钥)

SourceTree总是权限被拒绝(公钥)

无法通过ssh连接到github;权限被拒绝(公钥)

Bitbucket / Github:权限被拒绝的公钥

GitHub错误消息-权限被拒绝(公钥)

与Github Ansible:权限被拒绝(公钥)

Github SSH访问:权限被拒绝(公钥)

Git推送权限被拒绝(公钥),但已成功通过身份验证

Github:权限被拒绝(公钥),但是我收到“您已成功通过身份验证”消息

权限被拒绝(公钥)

GitHub:权限被拒绝(公钥)。严重的:无法从远程存储库读取

公钥身份验证权限被拒绝(publickey)

为什么[email protected]:Windows中的权限被拒绝(公钥)?

[email protected]:权限被拒绝(公钥)

Maven发布插件:权限被拒绝(公钥)Github

GitHub:权限被拒绝(公钥)。致命:远端意外挂断

Ansible git clone github 权限被拒绝(公钥)

使用ssh从github部署到linux服务器,但是权限被拒绝(公钥)。PHP脚本

SSH权限被拒绝(公钥)

git权限被拒绝(公钥)

ssh权限被拒绝(公钥)

SSH权限被拒绝(公钥)

SSH权限被拒绝(公钥)

通过SSH从远程服务器推送git commit:权限被拒绝(公钥)。严重的:无法从远程存储库读取

在清单中添加了权限但访问被拒绝

无法将文件压缩到gcloud:权限被拒绝(公钥)

权限被拒绝(公钥)。严重的:无法从远程存储库读取

无法从Windows运行cloudctrl bash-权限被拒绝(公钥)

无法SSH到服务器:权限被拒绝(公钥)