Github

Github 자주쓰는 명령어 및 압축정리 깃시작,소스업로드,소스다운받기

Sm_Developer 2022. 8. 19. 00:44

깃헙에 소스 업로드 하기까지 과정

 

 

 

내 컴퓨터에 깃 시작하기

 

1.git 시작

 

git init //초기화 및 .git 폴더 생성

 

2.git 상태 확인

 

git status

 

3.git 축약형 만들기

 

git config --global alias.st status //git status  == git st

 

4.git add를 통해서 StagingArea로 이동

 

git add 파일이름
ex)
git add *  //현재폴더내에 전체파일
git add *.txt //현재폴더내에 txt 전체파일

 

5.git commit을 통해 GitDirectory로 이동

 

git commit -a -m "커밋 제목"
ex)
git commit -a -m "first commit"

 

 

소스 업로드

 

1.현폴더의 원격 레포지토리를 확인하는 명령어

 

git remote

 

2.원격 레포지토리 추가

 

git remote add [원하는 원격저장소 이름] [자신의 깃헙 주소].git
ex)git remote add origin https:github.com/sm7540/practice.git

 

3.원격 레포지토리 확인

 

git remote 
//위에 저장한 레포지토리가 뜬다.

 

4.원격 레포지토리 주소 변경하기

git remote set-url  [원격저장소 이름] [변경하고싶은주소]
ex)
git remote set-url origin https:github.com/sm7540/practice.git

 

7.깃헙에 업로드하기

git push -u [원격저장소 이름][branch이름]
ex)git push -u [지정한 원격저장소 이름] [branch이름]

 

소스 다운받기

1.git clone으로 소스 전체 내려받기

 

git clone [자신의 깃허브 주소]
ex) git clone https:github.com/sm7540/practice.git

 

2.git fetch로 소스 동기화 (필요하다면?)

 

git fetch