当前位置:  开发笔记 > 编程语言 > 正文

无法使用SSH访问AWS CodeCommit

如何解决《无法使用SSH访问AWSCodeCommit》经验,为你挑选了1个好方法。

在确定如何使AWS CodeCommit与标准SSH身份验证协同工作时遇到极其困难的时间.看到这样的另一个话题,但没有答案,我不能发表评论.这是在Windows上使用Git Bash.

Repro步骤

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

    来自〜/ .ssh的Git Bash

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

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

    尝试访问CodeCommit仓库(在这种情况下尝试推送)并获得"权限被拒绝".

Git + SSH输出

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

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:
debug3: sign_and_send_pubkey: RSA SHA256:
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:
debug3: sign_and_send_pubkey: RSA SHA256:
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([192.30.252.130]:22).

以上输出来自运行正常的git命令,例如git push origin master启用了ssh debug logging .ssh/config:

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

Host github.com
  LogLevel DEBUG3

Wade Matveye.. 10

看起来你错过了设置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.



1> Wade Matveye..:

看起来你错过了设置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.

推荐阅读
女女的家_747
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有