在使用标准SSH身份验证时,我非常难以弄清楚如何让AWS CodeCommit正常工作。看到过另一个类似的主题,但没有答案,而且我现在还不能评论。这是在Windows上使用Git Bash。
复制步骤
- 创建具有完整权限的IAM用户(AwsAdministrator)
- 在Git Bash中的~/.ssh
- "cat id_rsa.pub"并将输出复制到剪贴板中
- 在IAM控制台中,单击添加SSH密钥按钮,并粘贴到输入字段中。然后,单击保存。
- 尝试访问CodeCommit repo(在这种情况下是尝试推送),然后收到“权限被拒绝”的错误消息。
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.
相比之下,我在使用完全相同的SSH密钥登录GitHub时所得到的结果如下:
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).
以上输出是通过在
.ssh/config
中启用ssh调试日志记录,运行诸如git push origin master
之类的常规git命令得出的:Host git-codecommit.us-east-1.amazonaws.com
LogLevel DEBUG3
Host github.com
LogLevel DEBUG3