방법
- 새로운 Repository 생성
- Repository name, Description, 공개범위 자유롭게 작성
- Add .gitignore에서 Unity 검색해 추가
- 원격 저장소와 로컬 폴더 연결
새로운 Repository 생성 후 이름, 설명, 공개 범위 결정
Add .gitignore 추가
(README도 기왕이면 추가)
원격 저장소와 로컬 폴더 연결
복사 버튼 눌러서 Repository 주소 복사
GitBash 또는 Terminal에서 저장소 연결
git init
git remote add origin "git repository 주소"
git pull origin main
// 혹시 기본 브랜치가 master로 설정되어 있다면 git pull origin master로
연결이 잘 되었다면 로컬에서 작업한 내용을 Repository에 commit, push할 수 있을 것이다. Add .gitignore를 했기 때문에 Repository 연결 후 바로 pull을 통해 main(또는 master)에 있는 .gitignore 파일을 받아주는 게 좋다.
.gitignore
로컬 폴더를 GitHub repository에 연동할 때 업로드하지 말아야 할 파일을 정의하기 위해 .gitignore 파일을 활용한다. .gitignore 파일은 Unity 프로젝트 폴더의 루트 폴더 (Assets 와 같은 level의 폴더)에 가져다 두면 된다.
최신 gitignore 파일
GitHub - github/gitignore: A collection of useful .gitignore templates
A collection of useful .gitignore templates. Contribute to github/gitignore development by creating an account on GitHub.
github.com
Visual Studio나 메모장에 해당 내용을 복사한 뒤 파일명을 .gitignore로 작성, 확장자는 없게끔 설정해주면 된다.
'Unity 공부' 카테고리의 다른 글
[Unity] Photon, Photon View 이용한 멀티 게임 만들기 (간단 예제) (1) | 2022.10.23 |
---|---|
[Unity] Text Mesh Pro Text (TMP text) Script 동적 생성 / 제어하기 (1) | 2022.10.21 |
[Git] 커밋 기록 조작하기 (1) | 2022.10.17 |
[Unity] 3D URP Asset Material 깨지는 문제 (Built-in → 3D URP 변환) (0) | 2022.10.09 |
[Unity] Visual Scripting(BOLT)에 C# script 내 함수, 변수 가지고 오기 (0) | 2022.09.22 |
댓글