본문 바로가기

⭐ AWS/CodeCommit

CodeCommit 에 소스코드 업로드 하기

AWS CodeCommit이란?

AWS에서 관리하는 GitHub이라고 생각하면 쉽다.

1. CodeCommit Repository 생성 & 사용

AWS Console → CodeCommit Repositories Create repository

이름만 정해주고 Create 눌러주면

2. 로컬 pc에서 codecommit repository clone 받기

일단 생성한 codecommit의 repository를  clone 받아야 한다.

명령어는 아래와 같다.

$ git clone https://git-codecommit.ap-northeast-2.amazonaws.com/v1/repos/resource
Cloning into 'resource'...
warning: You appear to have cloned an empty repository.

일단 위의 명령어를 실행하면 git 자격증명 화면이 나온다.

여기서 AWS 보안의 Codecommit 자격증명을 생성하거나 입력하여 인증을 하면 된다.

인증이 완료되면 아래 명령어를 입력 및 실행한다.

git init

혹시 push 하려는 폴더의 root 경로나 하위 경로에 .git 폴더가 존재한다면 지워주고 git init을 실행하자.

3. git bash를 실행한 폴더를 업로드하기

아래 명령어를 입력 및 실행하여 push할 폴더를 리스트에 추가한다.

git add .

git status를 입력하면 아래와 같은 정보를 볼 수 있는데 여기서 주의할 점은 아직 커밋이 되지 않았다는 것이다.

$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

4. commit 수행 후 push 하기

git commit

$ git commit -m "initial_commit"
[master (root-commit) f0f3f0a] initial_commit
 92 files changed, 48242 insertions(+)

git push + https

$ git push https://git-codecommit.ap-northeast-2.amazonaws.com/v1/repos/resource
Enumerating objects: 144, done.
Counting objects: 100% (144/144), done.
Delta compression using up to 4 threads
Compressing objects: 100% (116/116), done.
Writing objects: 100% (144/144), 3.74 MiB | 4.79 MiB/s, done.
Total 144 (delta 11), reused 0 (delta 0), pack-reused 0
To https://git-codecommit.ap-northeast-2.amazonaws.com/v1/repos/resource
 * [new branch]      master -> master

5. 정상적으로 업로드 되었는지 확인하기

아래와 같이 정상적으로 업로드 된것을 확인 할 수 있다.