CodeCommit是類似於Github的源代碼託管服務,完全兼容git。
收費方式爲:每個活動用戶每月1美金(每用戶每月10GB存儲量,2000 個GIT請求),超過額度後,每月每GB0.06美金,每個GIT請求 0.001美金。
下面介紹如何完成自己的第一個Commit。
首先生成一個擁有commit權限的用戶,並生成 訪問密鑰 ID 和私有訪問密鑰。
接着在CodeCommit創建一個repo
更新AWS CLI
由於只有大於等於1.7.38版本的CLI才支持CodeCommit。所以一般需要重新安裝AWS CLI
sudo pip uninstall awscli
sudo pip install awscli
aws --version
aws-cli/1.7.40Python/2.7.9 Linux/3.14.35-28.38.amzn1.x86_64
配置CLI的profile用戶
awsconfigure --profile CodeCommitProfile
AWS Access Key ID [None]: (填入 祕鑰ID)
AWS Secret Access Key [None]: (填入 私有訪問祕鑰)
Defaultregion name [None]: us-east-1
Defaultoutput format [None]: json
安裝git
sudo yum install git
設置git的認證信息
git config --globalcredential.helper '!aws --profile CodeCommitProfile codecommitcredential-helper $@'
git config --globalcredential.UseHttpPath true
克隆創建好的repo
git clone "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/aaaaaa"
向repo中添加文件,並提交
cd aaaaaa/
echo "test" > testfile
git status
git add testfile
git commit -m "test"
git push