无法使用SSH访问AWS CodeCommit [英] Can't access AWS CodeCommit with SSH

查看:138
本文介绍了无法使用SSH访问AWS CodeCommit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要弄清楚如何使AWS CodeCommit与标准SSH身份验证配合使用非常困难。看到了类似这样的另一个主题,但没有答案,还不允许我发表评论。

Having an incredibly difficult time figuring out how to get AWS CodeCommit to work with standard SSH authentication. Seen another topic like this but no answer and I'm not allowed to comment yet. This is on Windows using Git Bash.


  1. 创建的IAM用户具有完全权限(AwsAdministrator)

  2. 从〜/ .ssh中的Git Bash

  3. cat id_rsa.pub并将输出复制到剪贴板

  4. 在IAM控制台中,单击按钮以添加SSH密钥并粘贴到输入字段中。单击保存。

  5. 尝试访问CodeCommit存储库(在本例中为尝试推送)并获取权限被拒绝。

  1. Created IAM user with full permissions (AwsAdministrator)
  2. From Git Bash in ~/.ssh
  3. "cat id_rsa.pub" and copy output to clipboard
  4. In IAM console, click button to add SSH key and paste into the input field. Click Save.
  5. Attempt to access a CodeCommit repo (in this case trying to push) and get "Permission denied".



Git + SSH输出



这是我从SSH中获得的DEBUG3日志记录:

Git + SSH output

This is what I get from SSH with DEBUG3 logging:

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密钥得到的:

For comparison this is what I get using the exact same SSH keys to 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).

上面的输出来自运行普通的git命令,例如 git push origin master ,并且在 .ssh / config 中启用了ssh调试日志记录:

The above output was from running a normal git command such as git push origin master with ssh debug logging enabled in .ssh/config:

Host git-codecommit.us-east-1.amazonaws.com
  LogLevel DEBUG3

Host github.com
  LogLevel DEBUG3


推荐答案

您似乎错过了设置SSH的步骤。您需要将此信息添加到您的.ssh / config文件中:

It looks like you missed a step in setting up SSH. You need to add this information to your .ssh/config file:

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。

You can get Your-SSH-Key-ID from the IAM console.

这篇关于无法使用SSH访问AWS CodeCommit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆