1.在aws 的IAM 创建用户
2.为用户增加codecommitfullaccess的权限
3.将机器的ssh公钥添加到用户的安全证书
这里需要把ssh的密钥id记录一下。克隆代码的时候需要
4.创建codecommit仓库
5.使用ssh密钥id 验证 代码仓库是否可连接
1
2
3
4
5
6
7
|
[root@web1 ~]
# ssh ssh密钥id@git-codecommit.us-east-2.amazonaws.com
The authenticity of host
'git-codecommit.us-east-2.amazonaws.com (52.95.20.120)'
can't be established.
RSA key fingerprint is a9:6d:03:ed:08:42:21:be:06:e1:e0:2a:d1:75:31:5e.
Are you sure you want to
continue
connecting (
yes
/no
)?
yes
Warning: Permanently added
'git-codecommit.us-east-2.amazonaws.com,52.95.20.120'
(RSA) to the list of known hosts.
You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-2.amazonaws.com closed by remote host.
Connection to git-codecommit.us-east-2.amazonaws.com closed.
|
6.克隆代码到本地
1
2
|
[root@web1 ~]
# git clone ssh://ssh密钥id@git-codecommit.us-east-2.amazonaws.com/v1/repos/pngtree test
Initialized empty Git repository
in
/root/test/
.git/
|
7.git 的一些常用操作
1
2
3
|
git add ./
git commit -m “
test
”
git push origin master
|
本文转自 shouhou2581314 51CTO博客,原文链接:http://blog.51cto.com/thedream/1907885,如需转载请自行联系原作者