← Back to Blog

Setting Up Claude Code for GitHub: A Quick Guide

If you're wanting Claude Code to help you with GitHub, you're in the right place. This guide will walk you through the initial setup process.

What You'll Need

  • A github account
  • Claude Code installed
  • A github Personal Access Token
  • About 15-30 minutes of setup time

Part 1: Log on to github

  1. Click on your avatar > settings > developer settings > Personal Access Tokens > Tokens (classic)
  2. Generate new Token > Generate new token (classic)
  3. Give your token a name > Select an Expiration > Select Scope
  4. You will need to assign 'repo', 'workflow', 'admin:org','delete_repo' and 'write:discussion'
  5. Click Generate token and copy the token to your clipboard.

Keep this token safe as you won't be able to see it again!

Part 2: Set up the local workstation (Mac Specific)

  1. Open a terminal session
  2. Change directory to your working directory
  3. Type the following into the terminal hitting enter after each step
  4. git init
  5. git config --global user.name "Your Name" && git config --global user.email "you@example.com"
  6. sudo nano ~/.zshrc
  7. Add the following line to the end of the file: export GH_TOKEN=your_token_here
  8. Save and exit the editor (Ctrl + X, then Y, then Enter)
  9. Source the updated .zshrc file to apply the changes: source ~/.zshrc

Part 3: Create and populate the repository

  1. Open a terminal session
  2. Change directory to your working directory
  3. Invoke Claude Code
  4. Instruct Claude to create a repository > please create a private repository called your_repo_name with the description of your_project_description for this project
  5. Instruct Claude to create a GitHub README.md file for this repo > Please create a GitHub README.md file for this repository
  6. Instruct Claude to perform the initial push to GitHub > Please create an initial commit to the new repository
  7. Go check your repository was populated with your project files

Part 4: Create the GitHub actions

  1. Open a terminal session
  2. Change directory to your working directory
  3. Invoke Claude Code
  4. Instruct Claude to install the GitHub app > /install-github-app
  5. Follow the prompts, it will open a browser where you apply permissions, once complete return to Claude Code Terminal and hit ENTER
  6. Open the Pull Request in a Github browser window, Pull request has been pre populated, click create pull request. It should start working right away
  7. Once the pull request is created, return to the Claude Code Terminal and hit ENTER.

Summary

In this guide, we've walked through the process of setting up Claude for GitHub integration. By following these steps, you should have a fully functional setup that allows you to leverage Claude's capabilities within your GitHub repositories.

References : Claude Code GitHub Actions Documentation

If you have feedback use the contact form on my website.