Guides

Claude Code and GitHub: Save Your Project and Put It Online (2026)

Short answer: Make a free GitHub account, install Git and the GitHub CLI, and run gh auth login. Then ask Claude Code to commit and push your project to a private repo. It takes about 15 minutes, and GitHub is free. Hosting that deploys from GitHub starts at $2.23 a month.

See Hostinger web hosting prices

Claude Code can use Git and GitHub for you. Git saves versions of your project on your computer. GitHub is a free website that keeps a copy of those versions online. Together, they mean you can always undo a bad change, and your work is safe if your laptop dies.

You don’t need to learn Git commands. You set it up once, and then you ask Claude Code in plain English: “Save my changes” or “Push to GitHub”.

New to Claude Code? Start with our how to use Claude Code guide, then come back here.

What you’ll have at the end

What you need before you start

How much it costs

What Price Notes
GitHub Free $0 Unlimited public and private repos
Git and the GitHub CLI $0 Free tools
Claude Pro $20/mo, or $200 a year Includes Claude Code
Hostinger Unlimited web hosting (optional) $2.23/mo ($107.04 for 48 months) With our referral link, checked Nov 11, 2026. Renews at $16.99/mo. Deploys web apps from GitHub.

Part 1: Set up Git and GitHub

Step 1: Make a free GitHub account

Go to github.com and click Sign up. Follow the steps and confirm your email.

What you’ll see: your GitHub home page. The Free plan includes unlimited public and private repos.

Step 2: Check that Git is on your computer

Open your terminal. Paste this and press Enter:

git --version

What you’ll see: a line like git version 2.x.x. That means Git is ready.

Stuck? On a Mac, a box may pop up offering to install command line developer tools. Click Install and wait, then try again. On Windows, install Git from git-scm.com. Anthropic recommends Git for Windows so Claude Code can run its commands.

Step 3: Install the GitHub CLI

The GitHub CLI is a small free tool called gh. It lets Claude Code talk to your GitHub account.

On a Mac with Homebrew, paste this and press Enter:

brew install gh

On Windows, paste this into PowerShell and press Enter:

winget install --id GitHub.cli --source winget

Then close the terminal and open a new one.

What you’ll see: lines about downloading, then a fresh line. Type gh --version and press Enter to check. It should show a version number.

Stuck? If you don’t have Homebrew on your Mac, GitHub’s install page has other ways to get gh. On Windows, open a new PowerShell window after the install so it finds gh.

Step 4: Log in to GitHub from the terminal

Paste this and press Enter:

gh auth login

It asks a few questions. Use the arrow keys and Enter to answer:

  1. Pick GitHub.com.
  2. Pick HTTPS.
  3. Say Yes to log in to Git with your GitHub account.
  4. Pick Login with a web browser.

What you’ll see: a one-time code. Press Enter, and a browser tab opens. Type the code there and approve. Back in the terminal, it says you’re logged in.

Only type a code you started yourself. If a website or a stranger gives you a code, don’t use it.

Part 2: Let Claude Code push your project

Step 5: Open your project in Claude Code

Move into your project folder and start Claude Code. If your folder is called my-site, paste this and press Enter:

cd my-site

Then paste this and press Enter:

claude

What you’ll see: the Claude Code box, ready for you to type.

Step 6: Turn the folder into a Git project

Type this and press Enter:

Turn this folder into a git repository and make the first commit.
Add a .gitignore so secrets and big junk folders stay out.

A commit is a saved version of your project, with a short note about what changed.

What you’ll see: Claude Code asks to run a few git commands. Say Yes. It tells you when the first commit is done.

Why the .gitignore? It’s a list of files Git should skip. It keeps passwords and API keys (secret codes for other services) out of GitHub.

Step 7: Create a private repo and push

Type this and press Enter:

Use the gh tool to create a private GitHub repo called my-site and push my code to it.

Push means upload your saved versions to GitHub.

What you’ll see: Claude Code asks to run gh repo create and git push. Say Yes. It gives you a link to your new repo.

Step 8: Check it on GitHub

Click the link, or go to github.com and open my-site.

What you’ll see: your project’s files, with a lock icon and the word Private next to the name.

Part 3: The everyday loop

Step 9: Save and push after each change

After Claude Code changes your project and you like the result, type:

Commit my changes with a clear message and push to GitHub.

What you’ll see: a short note about what it saved, and a line saying it pushed.

Here are other things you can ask, from Anthropic’s own docs:

Step 10: Undo a bad change

If Claude Code breaks something, type:

Something broke. Show me the last few commits and help me go back to the one before this change.

What you’ll see: a list of your saved versions. Claude Code explains each one and asks before it moves anything back.

Part 4: Put your project online from GitHub

Your code is on GitHub, but GitHub doesn’t show it to the world as a live website. For that, you need hosting (a computer that shows your site to visitors all day).

Hostinger’s plan page says its Unlimited web hosting plan and higher can deploy web apps from GitHub or from an AI coding agent. It also handles Node.js apps built with React, Next.js, Vite or Vue. With our link, Unlimited is $2.23 a month for 48 months. You get a free domain for the first year.

See Hostinger web hosting See Hostinger VPS plans

You can also let Claude Code do the deploy. Hostinger’s free Connector add-on works with Claude Code. Once your hosting is ready, leave Claude Code with /exit, then paste this and press Enter:

claude mcp add hostinger -- npx -y @hostinger/mcp

Start claude again and ask: “Deploy this project to my Hostinger account and make it live.” Sign in to Hostinger in the browser tab that opens. Our how to use Claude Code guide walks through this part step by step.

Building an app with logins, a database or a bot? A VPS (a computer you rent that stays on all day) is a better fit. Our VPS vs shared hosting guide explains the difference.

Check that it worked

Open your repo on github.com. Click the commits link near the top. You should see each save Claude Code made, with its message and time. If your newest change is there, Git and GitHub are working.

Bonus: @claude inside GitHub

Claude Code can also work inside GitHub itself. You type @claude in a comment on an issue or pull request (a request to merge changes), and it reads the code, makes changes and pushes commits.

To set it up, open Claude Code in your project and type /install-github-app. It installs the Claude GitHub App, saves a secret key in your repo, and opens a pull request with the setup files. Merge that pull request, and @claude works in that repo. Anthropic’s docs say you need admin access to the repo, and the GitHub CLI must be logged in first.

If something went wrong

What you see What it means How to fix it
git: command not found, or Claude Code says Git is required Git isn’t installed Go back to Step 2 and install Git. Then open a new terminal.
gh: command not found The GitHub CLI isn’t installed, or the terminal is old Do Step 3, then close and reopen the terminal.
Permission denied or Authentication failed on push You’re not logged in to GitHub here Run gh auth login again (Step 4).
rejected or non-fast-forward on push GitHub has changes you don’t have yet Ask Claude Code: “Pull the latest changes from GitHub, fix any conflicts, then push.”
A password or API key ended up on GitHub It wasn’t in the .gitignore Change that password or key right away. Then ask Claude Code to remove the file and add it to .gitignore.

FAQ

Does Claude Code work with Git? Yes. Claude Code runs Git commands for you when you ask in plain English, like “commit my changes”. It asks before it runs them.

Do I need to pay for GitHub? No. GitHub’s Free plan includes unlimited public and private repos. It also includes 2,000 minutes a month for GitHub Actions.

Should my repo be public or private? Private, unless you want strangers to see your code. Private repos are free on GitHub.

What are Claude Code GitHub Actions? It’s a way to run Claude Code inside GitHub. You mention @claude in a comment, and it works on your code there. You set it up with /install-github-app, shown above.

Is GitHub the same as hosting? No. GitHub stores your code. Hosting shows your site to visitors. Hostinger’s Unlimited plan and higher can deploy straight from your GitHub repo.

What should I read next? Compare Claude Code with OpenAI’s tool in our Codex vs Claude Code guide.

Tested by: written by the WebHostCompared team on November 11, 2026, from Anthropic’s, GitHub’s and Hostinger’s own pages. Prices checked live that day. We haven’t added screenshots of each step yet.

Sources