Guide / Push & deploy / Start Step 0 / 13 0%

Part two · in Claude Code · Step 4 of 13

Connect GitHub
to Claude Code

Claude Code cannot see the repository you just made. One prompt fixes that — Claude does almost all of it and walks you through the single part it is not allowed to do for you.

Paste this into Claude Code
Help me connect my GitHub account so you can read my repositories and
open pull requests for me. I have never used a terminal, so keep
everything in plain language and explain any unfamiliar words.

1. Install the gh CLI if it isn't already installed, then run:
     git --version
     gh --version
     gh auth status
   Tell me what you found before changing anything else.

2. If I'm not logged in, don't try to log in for me. Instead, give me
   this exact command to run in my Claude Code terminal tab:
     gh auth login -h github.com -p https -w -c
   Then stay with me: tell me what appears on screen, what to do with
   the one-time code, and which option to choose if it asks me
   anything. Wait for me to tell you I'm finished.

3. Once I confirm, verify it worked: re-run gh auth status, run
   gh auth setup-git so ordinary git commands use my GitHub login,
   and set my commit name and email if they aren't set. Use my
   GitHub noreply email address.

4. Finish by telling me, in one short paragraph, what I can now ask
   you to do.

Never ask me to paste a password or a token into this chat.
Ground rule

Never paste a password, a token, or a one-time code into a chat with Claude — or anywhere except GitHub's own website. Nothing here asks you to.

What happens, and who does it

Claude does this

Checks and installs

Finds the tools it needs and installs what is missing. It will say you are not logged in yet — that is the normal starting point, not an error.

You do this

Run one command

Claude cannot log in for you, so it hands you a command to paste. Use the Terminal tab beside the conversation: click it, paste, press Return.

You do this

Click Authorize

Your browser opens GitHub. Paste the code, click Authorize, then tell Claude you have finished.

Claude does this

Verifies and finishes

Confirms the connection and fills in your commit name and email. It uses your GitHub noreply address, which keeps your personal email out of the public record.

What the terminal shows you, and what to answer

Five things can appear, in this order. The command answers most of them for you, so you will usually only see the last two — but every answer is here, so you never have to guess.

Do exactly this
Where do you use GitHub? Choose GitHub.com, press Return.
Preferred protocol for
Git operations?
Choose HTTPS, press Return.
Authenticate Git with your
GitHub credentials?
Type Y, press Return. This is what lets you upload files later without signing in every time.
How would you like
to authenticate?
Choose Login with a web browser, press Return.
! First copy your
one-time code: ABCD-1234
The code is already copied for you. Just press Return — your browser opens GitHub on its own. Yours will be a different code.

Where a question offers a list, move with the up and down arrow keys and confirm with Return.

Then, in the browser: paste the code (Cmd+V), click the green Authorize button, then go back to Claude Code and tell it you have finished.

You will know it worked

The terminal prints a line ending ✓ Logged in as followed by your GitHub username.

If part two went wrong
Anything unexpected at all
Paste what you see into Claude Code and ask what it means. That is the normal way to use it, not a failure — and faster than any troubleshooting list.
The one-time code expired
Press Control+C in the terminal tab and ask Claude for the command again. Nothing is broken.
I have a school account and a personal account
Tell Claude which one you want to use and it will sort out switching between them.

Confirm all three before continuing