<전제>

github.com에 회원가입을 먼저 해야한다

git이 설치되어 있어야한다 (source tree를 사용해도 된다)


1. github에 remote repository를 생성한다

 

 

 

.gitignore에서 Unity를 꼭 선택해주자

그렇지 않으면 불필요한 Library, Temp 파일들이 모두 커밋되어 용량이 심각하게 커진다


 

github url은 위와 같이 카피해올 수 있다

 

2. Unity 프로젝트 디렉토리에서 cmd를 실행하고 아래 커맨드를 실행한다

git init

git remote add origin https://github.com/ssaemo/Unity-2D-Side-Scroll.git

git pull origin master

git add .

git commit -m "first commit"

git push origin master # origin으로 local master commit을 push

git init : 

 - local repository 생성

git remote add <name> <remote-url> : 

 - local repository에, remote repository를 등록한다.

 - origin은 default name이고, remote-url은 github repo 페이지에서 카피해올 수 있다

git pull origin master

 - origin(remote repo)을 local repo의 master branch로 가져온다(pull)

 - master는 default branch이다

git add .

 - 모든 파일들을 index에 올린다 -> 모든 파일들을 commit하겠다는 의미

 - pull을 통해 .gitignore 파일이 생성되었으므로 불필요한 파일들은 무시된다

git commit -m "커밋내용(message)"

 - 메세지와 함께 local repo에 commit한다

 - 커밋메세지는 필수이며, 변경사항을 특정 commit으로 되돌릴 때 확인하기 위해 메인 변경사항을 메모한다

git push origin master

 - origin에 local repo master branch의 새로운 commit들을 올린다(push)

 

 


WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/