1.在aws 的IAM 创建用户
2.为用户增加codecommitfullaccess的权限
3.将机器的ssh公钥添加到用户的安全证书
这里需要把ssh的密钥id记录一下。克隆代码的时候需要
4.创建codecommit仓库
5.使用ssh密钥id 验证 代码仓库是否可连接
[[email protected] ~]# ssh ssh密钥[email protected] 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.克隆代码到本地
[[email protected] ~]# git clone ssh://ssh密钥[email protected]/v1/repos/pngtree test Initialized empty Git repository in /root/test/.git/
7.git 的一些常用操作
git add ./ git commit -m “test” git push origin master
时间: 2024-11-05 10:54:16