2022년 전에 정리한 문서들
ECS CI/CD Workshop 정리(2)
반가운사람2
2022. 8. 23. 20:01
반응형
실습 단계 요약
- 1단계: git 자격 증명 도우미, 사용자 이름 및 이메일 주소를 구성합니다.
- 2단계: 연결을 테스트합니다.
- 3단계: CodeCommit 콘솔을 탐색합니다.
- 4단계: 분기를 만들고 병합합니다.
- 5단계: 정리합니다.
1. git 자격 증명을 생성합니다.(1단계) Cloud9 환경에서 새로운 터미널을 연다음 진행합니다.
# git 구성 설정 확인
git config --global --list
#출력이 아래와 같다면 Cloud9은 이미 codecommit에 접근이 가능합니다.
credential.helper=!aws codecommit credential-helper $@
credential.usehttppath=true
#출력이 없다면 아래 명령을 사용합니다.
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
#git 사용자 이름과 이메일 주소를 설정
git config --global user.name "Your Name"
git config --global user.email you@example.com
2. 연결 테스트를 진행합니다.(2단계)
cd ~/environment/
mkdir git-test
cd git-test
git init
echo "Hello" > hello.txt
git add .
git commit -m "Test commit"
repo_url=$(aws codecommit create-repository --repository-name git-test --query repositoryMetadata.cloneUrlHttp --output text)
echo Pushing to $repo_url
git remote add origin $repo_url
git push -u origin master
위에 명령을 다 실행 후 Codecommit console로 이동 후 파일 업로드를 확인합니다.(3단계)
3. 분기를 만들고 병합합니다.(4단계) 브런치를 하나 더 생성합니다.
#브런치 생성
git checkout -b hotfix
#변경 사항 커밋 후 Push
git commit -a -m "Fixed issue"
git push -u origin hotfix
#Master를 Default로 다시 변환합니다.
git checkout master
git merge hotfix
git push origin master
Codecommit을 확인합니다.
4. 로컬 및 원격 테스트 저장소 정리(5단계)
aws codecommit delete-repository --repository-name git-test
cd ~/environment
rm -rf git-test
#삭제 확인(출력 표시되면 안됩니다.)
aws codecommit list-repositories | grep git-test
반응형