2019-06-03 配置AWS CodeCommit

CodeCommit 是什么? - AWS的介绍是这样的:

CodeCommit 是一项安全的、可高度扩展的托管型源代码控制服务,可用于托管私有 Git 存储库。CodeCommit 使您无需管理自己的源代码控制系统,并且再也不必担心基础设施的扩展了。您可以使用 CodeCommit 存储从代码到二进制文件的一切内容。它支持 Git 的标准功能,可与您现有的基于 Git 的工具无缝协作。 

一句话概括,就是私有GIT库,当然通过设置可以共享给其他人。
1、首先要在http://aws.amazon.com AWS上创建一个账户,然后在AWS账户里创建IAM用户。
2、登录AWS管理控制台,然后打开IAM控制台https://console.aws.amazon.com/iam/
3、在IAM导航窗选择Users,选择要配置进行CodeCommit访问的IAM用户。

屏幕快照 2019-06-03 16.30.59.png

4、在Permissions选项卡,选择Add Permissions, 然后在Grant permissions中选择 Attach existing policies directly。
![屏幕快照 2019-06-03 16.37.27.png](https://upload-images.jianshu.io/upload_images/12133543-c68f3986f4af998a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

4、本机安装Git就不说了,这个很容易。
5、为访问CodeCommit 安装Git凭证
同样,在IAM用户界面,点击Security credentials页,可以选择Create access Key, 或则Upload SSH public key,或者生成HTTPS凭证(HTTPS Git credentials for AWS CodeCommit)。这里建议直接上载SSH public key
6、这里介绍使用MAC和Linux连接,Windows的参考:Windows 上的 SSH 连接
6.1、生成ssh key : ssh-key -t rsa

$ ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/user-name/.ssh/id_rsa): Type /home/your-user-name/.ssh/ and a file name here, for example /home/your-user-name/.ssh/codecommit_rsa

Enter passphrase (empty for no passphrase): <Type a passphrase, and then press Enter>
Enter same passphrase again: <Type the passphrase again, and then press Enter>

Your identification has been saved in /home/user-name/.ssh/codecommit_rsa.
Your public key has been saved in /home/user-name/.ssh/codecommit_rsa.pub.
The key fingerprint is:
45:63:d5:99:0e:99:73:50:5e:d4:b3:2d:86:4a:2c:14 user-name@client-name
The key's randomart image is:
+--[ RSA 2048]----+
|        E.+.o*.++|
|        .o .=.=o.|
|       . ..  *. +|
|        ..o . +..|
|        So . . . |
|          .      |
|                 |
|                 |
|                 |

起名codecommit,在~/.ssh/目录下生成codecommit_rsa和codecommit_rsa.pub文件
6.2 拷贝公钥 cat ~/.ssh/codecommit_rsa.pub
回到IAM控制台,点击Upload SSH public key, 粘贴拷贝的公钥内容,然后能够看到一个SSH key ID.



6.3 回到本机,在~/.ssh/目录下生成叫做config的文件,内容如下:

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

这里的User就是刚才在AWS记录下来的SSH key ID.
6.4 更改配置文件属性:

chmod 600 config

7、使用CodeCommit
回到AWS CodeCommit控制台,找到你创建的Repositories, 点击 Clone URL, 会拷贝git库的链接,或者由管理员发给你链接:


屏幕快照 2019-06-03 16.54.57.png

然后回到本机,git clone XXXXXXXX,剩下的就跟通常使用git一样没啥区别了。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 第一部分:Git的基本操作 初始化操作 $ git config -global user.name #设置提交...
    庄欲以莘阅读 2,009评论 0 4
  • Chapter 12: Security on AWS B. All decommissioned magneti...
    K1024阅读 768评论 0 0
  • 软件需求:Git-core,gitosis, openssh-server, git-daemon-run(ubu...
    BUG弄潮儿阅读 2,196评论 0 0
  • java是一种时下最流行的编程语言之一 跨平台:软件(操作系统)+(cpu)称为平台,程序一次编译,可以到处运行。...
    碧木魚阅读 129评论 0 0
  • Face Recognition是人脸识别库,支持从Python或命令行识别和篡改人脸。此外还提供了一个简单的fa...
    1eb034fb5715阅读 100评论 0 1