gpt4 book ai didi

linux - 权限被拒绝(公钥)Git 和 AWS EC2

转载 作者:太空宇宙 更新时间:2023-11-04 05:22:42 28 4
gpt4 key购买 nike

与此授权问题相关的类似问题和解答有很多 ---“权限被拒绝(公钥)”。然而,它们都不能解决我的问题......

这是我的情况:我使用亚马逊网络服务器 EC2,我的电脑与服务器连接良好。下一步,我尝试在服务器上安装 git。我希望实现的结果是当我从本地推送时更新服务器端。但问题出现了:“权限被拒绝(公钥)”

OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/IvyLin/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to 52.68.24.4 [52.68.24.4] port 22.
debug1: Connection established.
debug1: identity file /Users/IvyLin/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ed25519-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 OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 52.68.24.4: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: ecdsa-sha2-nistp256 SHA256:ieQEskLZ3tiW76F5KPhlQfHcGYFW+SifiIDQnBUZHmY
debug1: Host '52.68.24.4' is known and matches the ECDSA host key.
debug1: Found key in /Users/IvyLin/.ssh/known_hosts:5
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/IvyLin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /Users/IvyLin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/IvyLin/.ssh/id_dsa
debug1: Trying private key: /Users/IvyLin/.ssh/id_ecdsa
debug1: Trying private key: /Users/IvyLin/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

我想知道的一件事是我应该将公钥到底放在哪里?服务器中已有一个用于“验证服务器连接”的 .ssh 文件,路径:~/.ssh,它对我有用。就git的ssh key 而言,我在git文件夹内创建了另一个.ssh文件夹,路径:~/home/git/.ssh。连接期间它会查找哪个文件?虽然我尝试将公钥放入 ~/.ssh 中,但仍然不起作用...

我已经被困在那里很长时间了,如果有人能帮助我,我真的很感激!实现“更新即推送”的解决方法也将帮助我!

最佳答案

One thing I am wondering is where should I put the public key exactly?

您必须将公钥放在您帐户下的 git 服务器上。

Which file does it look for during the connection?

您必须将~/.ssh/id_rsa.pub复制到您的git服务器帐户

关于linux - 权限被拒绝(公钥)Git 和 AWS EC2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38819255/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com