Proceed step by step with the setup for using Git and GitHub for the first time. Steps that are already complete are automatically skipped.
Collecting Status
Run the following 9 commands all in parallel :
which git— Whether Git is installedgit config --global user.name— Usernamegit config --global user.email— Emailwhich gh 2>/dev/null && echo "installed" || echo "none"— Whether GitHub CLI is installedgh auth status 2>&1— GitHub authentication status (successful if the output contains "Logged in")git rev-parse --git-dir 2>/dev/null && echo "repo" || echo "no-repo"— Whether it is a Git repositorygit remote get-url origin 2>/dev/null || echo "no-remote"— Whether a remote repository is connectedgit ls-remote --heads origin main 2>/dev/null | grep -q main && echo "remote-branch: exists" || echo "remote-branch: none"— Whether a remote main branch existsfor hook in pre-commit commit-msg pre-push; do test -x .git/hooks/$hook && echo "$hook: exists" || echo "$hook: none"; done— Whether git hooks are installed
Progress Rules
- Analyze the results and skip steps that are already complete.
- Proceed in order starting from the first incomplete step.
- Complete each step one at a time, then move on to the next step.
- For steps that require user input, always use AskUserQuestion.
- Provide all explanations in Korean, at a level appropriate for a user using Git for the first time.
Step 1: Check Git Installation
Completion condition: which gitReturns this path
If not installed, provide guidance:
Git이 설치되어 있지 않습니다.
터미널에서 아래 명령어를 직접 실행하세요:
xcode-select --install
설치 팝업이 나타나면 "설치" 버튼을 클릭하세요.
설치가 완료되면 다시 /git-onboarding-setup 을 실행해주세요.
Do not run xcode-select directly from Claude, since it requires a GUI popup. Only provide guidance and stop at this step.
Step 2: Set Username
Completion condition: git config --global user.nameThis is not empty
Ask for the name using AskUserQuestion:
- question: "Enter the name to use in Git. This is the name that will remain in the commit history."
- header: "Name"
- options:
- Suggest the current system username as the default option
Once you receive the name, run:
git config --global user.name "<입력받은 이름>"
Step 3: Set Email
Completion condition: git config --global user.emailThis is not empty
Ask for the email using AskUserQuestion:
- question: "Enter the email to use in Git. We recommend using the same email as your GitHub account. If you do not want to make your email public, you can use GitHub's noreply email (check it in GitHub > Settings > Emails)."
- header: "Email"
- options:
- "Use noreply email" — The private email provided by GitHub Settings > Emails (username@users.noreply.github.com)
- "Enter manually" — Enter your own email address directly
Once you receive the email, run:
git config --global user.email "<입력받은 이메일>"
Step 4: Check GitHub CLI Installation
Completion condition: which ghReturns the path
If not installed, provide installation instructions using AskUserQuestion:
- question: "GitHub CLI (gh) is not installed. How would you like to install it?"
- header: "gh installation"
- options:
- "Install with Homebrew (Recommended)" — Recommended for Mac users.
brew install gh - "Manual installation" — https://cli.github.com download from
- "Install with Homebrew (Recommended)" — Recommended for Mac users.
If you chose Homebrew:
brew install gh
If you chose manual installation, guide the user:
아래 링크에서 GitHub CLI를 다운로드하여 설치하세요:
https://cli.github.com
설치가 완료되면 다시 /git-onboarding-setup 을 실행해주세요.
Manual installation cannot be executed by Claude, so provide guidance only and stop at this step.
Step 5: GitHub Login
Completion criteria: gh auth status 2>&1 "Logged in" is included in the output
If not logged in to GitHub, guide the user:
GitHub에 로그인해야 합니다.
터미널에서 아래 명령어를 직접 실행하세요:
gh auth login --hostname github.com --git-protocol https --web
브라우저가 자동으로 열리고 인증 코드가 표시됩니다:
1. 터미널에 나오는 코드를 확인
2. 브라우저에서 코드를 입력하고 인증 완료
완료되면 다시 /git-onboarding-setup 을 실행해주세요.
gh auth loginrequires browser interaction, so do not execute it directly by Claude. Provide guidance only and stop at this step.
When the user reports completion, check the authentication status:
gh auth status 2>&1
If the "Logged in" message appears, it is successful. If it fails, guide the login process again.
Step 6: Prepare Repository
Completion criteria: git rev-parse --git-dirThis succeeds (the current directory is a Git repository)
If it is not a Git repository, ask how to proceed with AskUserQuestion:
- question: "The current directory is not a Git repository. How would you like to start?"
- header: "Repository"
- options:
- "Clone existing repository" — Import a repository that already exists on GitHub
- "Create new repository" — Initialize the current folder as a Git repository
If clone is selected: Ask for the repository URL and then run:
git clone <URL>
If new repository is selected:
git init
Step 7: Connect GitHub Remote Repository
Completion criteria: git remote get-url originThis returns the GitHub URL
If there is no remote repository (no-remote), ask how to proceed with AskUserQuestion:
- question: "Would you like to create a remote repository on GitHub?"
- header: "Remote Repository"
- options:
- "Create new repository (Recommended)" — Create a repository on GitHub and connect it automatically
- "Connect existing repository" — Enter the URL of a repository that already exists on GitHub
Create new repository
Ask about visibility with AskUserQuestion:
- question: "Should the repository be public or private?"
- header: "Visibility"
- options:
- "Public" — Anyone can view it
- "Private (Recommended)" — Only I can view it (can be changed later)
Use the current directory name as the repository name:
gh repo create $(basename "$PWD") --source=. --remote=origin --<public|private>
--source=.uses the current directory as the source, and --remote=originautomatically adds the remote.
Connect existing repository
Ask for the repository URL and then run:
git remote add origin <URL>
Confirm
After connecting, verify:
git remote -v
If origin's fetch/push URL is output, it is successful.
Step 8: Initialize Remote Branch (First Push)
Completion criteria: git ls-remote --heads origin main 2>/dev/nullThis returns the result (the main branch exists on the remote)
Check with the command below:
git ls-remote --heads origin main 2>/dev/null | grep -q main && echo "remote-branch: exists" || echo "remote-branch: none"
If the remote does not have a main branch (a newly created repository), create an initial commit and push it:
git log --oneline -1 2>/dev/null
If there are no commits at all, create an initial commit:
git add -A
git commit -m "chore: initial commit"
Push to the remote:
git push -u origin main
Explain to the user:
GitHub에 main 브랜치를 생성했습니다.
이제 원격 저장소와 로컬이 연결되었습니다.
Step 9: Choose the working environment
Ask the user about the working environment with AskUserQuestion:
- question: "Will this repository be used by yourself or by a team?"
- header: "Working environment"
- options:
- "Personal project" — a repository you work on alone (skip installing git hooks)
- "Team project (Recommended)" — multiple people working together (branch protection with git hooks)
If the team project is selected
Completion conditions: .git/hooks/pre-commit, .git/hooks/commit-msg, .git/hooks/pre-push All files exist and have execute permissions
Check with the command below:
for hook in pre-commit commit-msg pre-push; do test -x .git/hooks/$hook && echo "$hook: exists" || echo "$hook: none"; done
If any hook is missing, copy and install the template file from the plugin.
PLUGIN_ROOTis the plugin's git-hooks/ directory path: ${CLAUDE_PLUGIN_ROOT}/git-hooks
cp ${CLAUDE_PLUGIN_ROOT}/git-hooks/pre-commit .git/hooks/pre-commit
cp ${CLAUDE_PLUGIN_ROOT}/git-hooks/commit-msg .git/hooks/commit-msg
cp ${CLAUDE_PLUGIN_ROOT}/git-hooks/pre-push .git/hooks/pre-push
chmod +x .git/hooks/pre-commit .git/hooks/commit-msg .git/hooks/pre-push
Do not overwrite hooks that already exist. Copy only the ones that are missing.
Explain the role of each hook to the user:
Git hook을 설치했습니다.
pre-commit: main/master에서 commit 차단 → 새 브랜치로 안내
commit-msg: conventional commits 형식 검증 (feat:, fix:, docs: 등)
pre-push: main/master로 push 차단 → 새 브랜치로 안내
터미널에서 직접 git을 사용할 때도 동일하게 보호됩니다.
If the personal project is selected
Skip installing Git hooks and go straight to the completion message.
Completion message
Once all steps are complete, output a summary of the setup:
Git 초기 설정이 완료되었습니다.
이름: <user.name>
이메일: <user.email>
GitHub: 로그인됨
저장소: <현재 디렉토리>
원격: <origin URL>
보호: <"팀 — main 보호 + conventional commits (git hooks)" 또는 "개인 — 없음">
다음 단계: /git-onboarding-workflow 를 실행하면 브랜치 생성부터 PR까지 안내합니다.