newrepo目录下建立本地库:git init newrepo
设置用户信息:
$ git config --global user.name "runoob"
$ git config --global user.email test@runoob.com
一、使用SSH
- 生产密钥:ssh-keygen
id_rsa 文件,该文件为私有密钥文件。
id_rsa.pub 文件,该文件为公有密钥文件。 - 打开公有密钥:notepad id_rsa.pub
- IAM->用户->安全->上传SSH
- IAM控制台添加SSH生成SSH Key ID
- notepad ~/.ssh/config
将以下行添加到该文件中,其中 User 的值是您之前复制的 SSH 密钥 ID,IdentityFile 的值是私有密钥文件的路径和名称:
Host git-codecommit.*.amazonaws.com
User APKAEIBAERJR2EXAMPLE
IdentityFile ~/.ssh/id_rsa -
连接服务器
-
ssh git-codecommit.us-east-2.amazonaws.com
-
-
拷贝库文件,ssh..为COMMIT控制台复制的SSH
-
git clone ssh://git-codecommit.cn-northwest-1.amazonaws.com.cn/v1/repos/JXKJ
-
二、使用HTTPS
- IAM控制台生成HTTPS Git凭证,下载凭证.CSV 文件
- IAM->用户->安全->下载HTTPS Git
- 连接服务器,https..为COMMIT控制台复制的HTTPS
- git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo my-demo-repo
- 填入账号和密码(凭证.CSV)