弄清楚如何让 AWS CodeCommit 与标准 SSH 身份验证配合使用非常困难。看到另一个类似的主题,但没有答案,我还不能发表评论。这是在 Windows 上使用 Git Bash。
重现步骤
- 创建具有完全权限的 IAM 用户 (AwsAdministrator)
- 来自 ~/.ssh 中的 Git Bash
- “cat id_rsa.pub”并将输出复制到剪贴板
- 在 IAM 控制台中,单击 按钮添加 SSH 密钥并将其粘贴到输入字段中。单击“保存”。
- 尝试访问 CodeCommit 存储库(在本例中尝试推送)并收到“权限被拒绝”。
Git + SSH 输出
这是我从带有 DEBUG3 日志记录的 SSH 中得到的结果:
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/Dan/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug2: input_userauth_pk_ok: fp SHA256:<omitted>
debug3: sign_and_send_pubkey: RSA SHA256:<same-as-above>
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
fatal: Could not read from remote repository.
为了进行比较,这是我使用与 GitHub 完全相同的 SSH 密钥得到的结果:
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/Dan/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug2: input_userauth_pk_ok: fp SHA256:<same-as-above>
debug3: sign_and_send_pubkey: RSA SHA256:<same-as-above>
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([192.30.252.130]:22).
上面的输出来自运行普通的 git 命令,例如git push origin master
启用 ssh 调试日志记录.ssh/config
:
Host git-codecommit.us-east-1.amazonaws.com
LogLevel DEBUG3
Host github.com
LogLevel DEBUG3
您似乎错过了设置 SSH 的步骤。您需要将此信息添加到您的 .ssh/config 文件中:
Host git-codecommit.us-east-1.amazonaws.com
User Your-SSH-Key-ID, such as APKAEIBAERJR2EXAMPLE
IdentityFile Your-Private-Key-File, such as ~/.ssh/codecommit_rsa or ~/.ssh/id_rsa
您可以从 IAM 控制台获取 Your-SSH-Key-ID。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)