버전 관리 - GitHub 업로드(Push)

01.Git 업로드 명령어

//  1.PC에 GitBash가 잘 설치 되어 있는지 확인
git --version 

// 2.Git 저장소를 생성하는 명령어
git init 

// 3.개행문자 설정
git config --global core.autocrlf input // macOS
git config --global core.autocrlf true // window

// 4.사용자 정보 설정 (한 번만 지정해주면 됨)
git config --global user.name 'JangJinWon'
git config --global user.email '[email protected]'

// 5.등록한 정보 확인
git config --global --list

// 6.프로젝트 구조 확인 (현재 저장소 내 파일들의 상태 확인)
git status 

// 7.버전 관리를 위한 등록 (파일들을 인덱스(Staging Area)로 보내는 명령어)
git add . 

// 8.인덱스에 보낸 파일들을 커밋하는 명령어
git commit -m 'Start project' 

// 9. 커밋 기록 보기 (커밋하여 등록한 버전을 확인하는 명령어)
git log 

02.GitHub 업로드 과정

2-1.GitHub 레파지토리(Repository) 생성

  • github 사이트에서 로그인 후 우측 상단에 보면 +버튼을 눌러서 New repository를 눌러줍니다.
  • Repository name을 설정하고 밑에 있는 Create respository 버튼을 눌러주면 새로운 repository가 생성됩니다.

2-2.GitHub 레파지토리(Repository)에 소스 올리기(push)

  • Git repository를 생성하였으니 이제 ...or push an existing repository from the command line 부분에 있는 순서대로 진행하여 내가 생성한 Git repository에 push 해주면 됩니다.
  • 내가 생성한 Git repository 주소 복사 후 다음 명령어들을 입력해주면 됩니다.
git remote add origin [repository 주소]
git push -u orign master
// 실제 사용한 명령어
git remote add origin https://github.com/JangJinWon/NewTest.git
git push -u origin master

2-3.생성한 GitHub 레파지토리(Repository) 확인

  • 성공적으로 push 되었다면 나의 GitHub repository 페이지에서 확인할 수 있습니다.

좋은 웹페이지 즐겨찾기