brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Jun 07. 2020

393. CodeCommit 레파지토리 사용하기

목표

AWS CodeCommit 레파지토리 알아보기

Git 레파지토리와 같은 역할. 

소스 보관 역할



<0> 구성

EC2 (로컬 리파지토리)------------ AWS Codecommit 리포지토리(동기화)



순서

<1>  CodeCommit 레파지토리 생성

<2>  EC2 접속  , EC2에 local repository 생성

<3>  EC2를  AWS Codecommit에 동기화 하기



<1> CodeCommit 레파지토리 생성


Services > CodeCommit > create repository

seo-repo

seo  repository

create




<2>  EC2 접속  , EC2에 local repository 생성


1

EC2 접속 

# yum install -y git


git config --global credential.helper '!aws codecommit credential-helper $@' 


git config --global credential.UseHttpPath true


2

CodeCommit  웹 Console에서  Clone URL

clone https


3

EC2에서 aws 레파지토리 복사받기


git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/seo-repo



<3>  EC2를  AWS Codecommit에 동기화 하기


1

파일 2개를 로컬 레파지토리에 만듦


// EC2 에서

cd ~/seo-repo

echo " test file 1 " >1.txt

echo "Test file 2" > 2.txt

ls


git add 1.txt 2.txt


2

git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: 1.txt
new file: 2.txt

3
git config --global user.name "Your Name"

git config --global user.name "seo"


git config --global user.email you@example.com

git config --global user.email topasvga@naver.com


4

// 설명 달기

git commit -m "Added 1.txt and 2.txt"


5

git log

Author: seo <topasvga@naver.com>

Date:   Tue Jul 14 09:59:43 2020 +0000

    Added 1.txt and 2.txt




<4> commit


1

git push -u origin master

Counting objects: 4, done.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (4/4), 269 bytes | 269.00 KiB/s, done.

Total 4 (delta 0), reused 0 (delta 0)

To https://git-codecommit.us-east-1.amazonaws.com/v1/repos/seo-repo

 * [new branch]      master -> master

Branch master set up to track remote branch master from origin.



2 AWS에서 확인

code commit 에 가면 

seo-repo에 

1.txt , 2.txt  이 올라와 있다..



감사합니다.



매거진의 이전글 392.EC2,VPC flow,Trail 로그 모니터

작품 선택

키워드 선택 0 / 3 0

댓글여부

afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari