상세 컨텐츠

본문 제목

[Git]git remote : github 로컬저장소와 원격저장소 연결

Software Engineering

by mobile 2016. 6. 17. 15:43

본문

반응형

■ 로컬저장소와 원격저장소 연결


1) git init : 저장소 생성 (로컬 저장소)

// 폴더 생성

mkdir test_empty


// 폴더 이동

cd test_empty


// git 저장소 생성

git init



2) 파일 생성 후 커밋 (로컬 저장소)

// 파일 생성 후 편집

vim hello.py


// git 상태 확인

git status


// 저장소에 파일 추가

git add hello.py (git add .)


// 저장소에 등록

git commit -m "first commit add hello.py"



3) git hub 저장소 생성 (Initialize this repository with a README 체크옵션 해제)


4) git remote : 로컬 저장소와 원격 저장소 연결

git remote add 저장소별칭 https://github.com/사용자이름/원격저장소이름.git


// 사용 예

git remote add origin https://github.com/semiguy/test_empty.git



5) git push : 로컬 작업 내역을 원격 저장소에 등록

git push 원격저장소별칭 로컬브랜치이름


--all : 원격저장소에 로컬의 모든 브랜치를 푸시


//사용 예

git push origin --all



6) git hub README.md 추가 (로컬 저장소)

cat >> README.md

create repository test_empty



7) 원격저장소에 등록

git add README.md

git commit -m "remote repository add a README.md"

git push origin master



8) github 연동 확인


반응형

관련글 더보기

댓글 영역