繁体   English   中英

如何使用codecommit设置git所以我不必每次都添加ssh key id?

[英]How to setup git with codecommit so i don't have to add ssh key id everytime?

我把我的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密钥ID(在IAM控制台中),'IdentityFile'是您使用'ssh-keygen'生成的RSA私钥文件的位置,该文​​件与您的IAM用户关联。

来源: CodeCommit SSH设置文档

应该将以下内容添加到.ssh/config就足够了。

Host git-codecommit.*.amazonaws.com
   User my-ssh-key-id

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM