유니티 깃 프로젝트 생성 자동화


➀ Github CLI 설치하고 로그인

C:\Users\dbwjaud>gh auth login
? Where do you use GitHub? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser

setup_unity_git.bat 생성

@echo off
setlocal

:: 리포지토리 이름 입력받기
set /p repoName="Enter repository name: "

if "%repoName%"=="" (
    echo 리포지토리 이름을 입력하세요.
    exit /b 1
)

echo 🔧 Setting up Git for Unity project...

:: Git 초기화
git init
git branch -m main

:: Unity .gitignore 다운로드
echo 📄 Downloading Unity .gitignore...
curl -sS https://raw.githubusercontent.com/github/gitignore/main/Unity.gitignore -o .gitignore
git add .gitignore
git commit -m "Add Unity .gitignore"

:: GitHub에 리포지토리 생성
echo 🌍 Creating GitHub repository...
gh repo create "%repoName%" --private --source . --remote origin

echo Git setup complete!
pause

➂ 프로젝트 디렉토리에 .bat 파일 넣고 실행

➃ Github Desktop에서 프로젝트 add하고 push