我已将 ssh 上传到 aws,我可以这样做(我使用的是 ubuntu):
git clone ssh://my-ssh-key-id@git-codecommit.xxx.amazonaws.com/v1/repos/yyy
但是我不能只复制粘贴 codeCommit 提供的 repo url 并在没有 key ID 的情况下简单地使用它,例如:
git clone ssh://git-codecommit.xxx.amazonaws.com/v1/repos/yyy
我应该如何配置我的 git 或 ssh 来实现它?
最佳答案
修改您的 ~/.ssh/config 文件,使其具有如下内容:
Host git-codecommit.*.amazonaws.com
User APKAEIBAERJR2EXAMPLE
IdentityFile ~/.ssh/codecommit_rsa
其中“User”是为您的 IAM 用户生成的 SSH key ID(在 IAM 控制台中),“IdentityFile”是您使用“ssh-keygen”生成的 RSA 私钥文件的位置,它与您的 IAM 用户。
关于linux - 如何使用 codecommit 设置 git,这样我就不必每次都添加 ssh key ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47126399/