如何在同一台计算机上使用和克隆github和AWS(CodeCommit)仓库?

迈克尔·杜兰特

如何设置系统,以便可以从两个来源(github和aws CodeCommit)进行克隆,而无需进行每次切换的更改?

迈克尔·杜兰特

创建或编辑~/.ssh/config文件

使内容为:

Host git-codecommit.*.amazonaws.com
  User APKAS2GIPODK7YOUR-ID 
  IdentityFile ~/.ssh/codecommit_rsa

Host github.com
  User your_github_username
  IdentityFile ~/.ssh/id_rsa

我假设您已经按如下方式生成了github ssh密钥,id_rsa并按id_rsa.pub如下所示生成了aws密钥以创建codecommit_rsa文件,即与githubid_rsa文件不同的文件

$ ssh-keygen                                                                                                                                   
Generating public/private rsa key pair.                                                                                                        
Enter file in which to save the key (/home/durrantm/.ssh/id_rsa): /home/durrantm/.ssh/codecommit_rsa     

#
# **NOTE** As shown, change above filename from id_rsa to codecommit_rsa !!! 
# This avoids over-writing your github id_rsa keys (so you can have both)
# So don't just press return for defaults !!!                                     
#

Enter passphrase (empty for no passphrase):                                                                                                    
Enter same passphrase again:                                                                                                                   
Your identification has been saved in /home/durrantm/.ssh/codecommit_rsa.                                                                      
Your public key has been saved in /home/durrantm/.ssh/codecommit_rsa.pub. 

现在我可以克隆任一回购

$ git clone ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/HellowBlueGreenWorld
Cloning into 'HellowBlueGreenWorld'...
remote: Counting objects: 6, done.
Receiving objects: 100% (6/6), 759 bytes | 759.00 KiB/s, done.
...


$ git clone [email protected]:durrantm/setups.git
Cloning into 'setups'...
remote: Enumerating objects: 9, done.
...
Receiving objects: 100% (1739/1739), 1.21 MiB | 4.52 MiB/s, done.
...

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在同一台计算机上安装Windows和Ubuntu?

如何在同一台计算机上同时使用Flutter stable和dev SDK?

如何在同一台计算机上克隆用户配置文件?

在同一台计算机上拥有单独的GitHub和Bitbucket帐户

如何在同一台计算机上的 python 2 和 3 上安装 pygame?

在同一台Linux计算机上使用NVIDIA和ATI卡

(最简单的)在同一台计算机上使用Python 3.6和3.7的方法?

在同一台计算机上使用vue 2和vue 3

如何在同一台计算机上使用多个版本的Laravel?

在同一台计算机上运行裸机管理程序和VM

Mesos的“主”和“从”节点可以部署在同一台计算机上吗?

在同一台计算机上同时安装Homebrew和Macports是否安全?

同一台计算机上的内核应急(6)和Linux安装问题过多

Windows和Linux在同一台计算机上的理想设置?

适用于Windows和Linux的同一台计算机上的套接字

在同一台计算机上运行Java 32位和64位

Xcode 6和Xcode 5可以在同一台计算机上共存吗?

同一台计算机上的 Ubuntu 18.04 和 20.04

在同一台计算机上运行Elm 0.18和0.19

在同一台计算机上具有不同版本的Python和Anaconda

在同一台计算机上复制和同步文件

在同一台计算机上安装开发和生产版本

如何在 windows 中使用两个用户在同一台计算机上使用两个 GitHub 帐户?

在同一台计算机上同时运行Master和Agent时,Jenkins如何处理资源?

使用Ubuntu 18.04在同一台计算机上同时安装wine和steam(Linux版本)吗?

如何在同一台计算机上运行2个(或更多)Wildfly实例?

如何在同一台计算机上配置多个ASPNETCORE_ENVIRONMENT?

如何在同一台计算机上运行多个Graph Engine实例?

如何在同一台计算机上同时运行Synergy客户端和Synergy服务器?