AI & prompting

How to Connect Claude to GitHub: Chat, Claude Code and @claude

To connect Claude to GitHub, pick the method that matches what you want. In claude.ai, click the "+" button and choose "Add from GitHub" to give Claude your repository files. To have Claude work inside your repository, run /install-github-app in Claude Code, then tag @claude in an issue or pull request.

The word "connect" covers three different setups, and they need different accounts and permissions. Anthropic's documentation describes each one separately. This article follows that split and states which steps apply to which setup. Details are as of November 2026, and menu labels can change.

Which connection do you need?

You wantUseWhat Claude gets
Ask questions about code in a chatclaude.ai "Add from GitHub"File names and contents from a branch
Replies and code changes inside GitHub issues and pull requestsClaude GitHub App plus the GitHub ActionA workflow that can read and write contents, issues and pull requests
Run Claude Code on Anthropic's servers against your repositoryCloud sessions, via the GitHub App or /web-setupClone and push access to the repositories you allow

If you only want Claude to see your code while you chat, use the first row. It is the lightest setup and never writes to your repository.

How to connect GitHub in claude.ai (chat and projects)

This is what most people searching "how to connect Claude to GitHub" want. You pick files from a repository, and Claude uses them as context.

If you aren't signed in to GitHub, claude.ai redirects you to GitHub to authenticate first. After that:

  • In a chat: click the "+" in the lower-left corner, choose "Add from GitHub", use the file browser to select files and folders, then send your message.
  • In a project: click the "+" in the upper-right corner of the project knowledge section, choose "GitHub", search your accessible repositories or paste a repository URL, and select files and folders.

In a project, the "Sync" icon pulls the latest version of the selected files, and the "Configure files" icon changes which files Claude analyzes. You can add several repositories, but together they must fit within Claude's context window. Pick the folders that matter instead of a whole monorepo.

What the chat integration does not do

Only file names and contents from one branch are synced. Commit history, pull requests and other metadata are not retrieved. Claude cannot push, open issues or comment on pull requests through this route. Changes you make on GitHub also do not appear automatically: sync again to update every file and folder you selected earlier.

Private repositories

If a valid repository URL doesn't work, you are most likely pointing at a private repository. A GitHub administrator can grant the Claude GitHub App access to all repositories or to specific ones. A non-administrator can request access, and the organization's administrators are notified by email. After approval, sync and the repository becomes available.

If your organization requires SSO, private repositories may not show up until each user authorizes the Claude app for that organization at github.com/settings/applications. If you lose access to a repository later, you can no longer view its contents in projects where it was added, although conversation history is kept.

One limit worth knowing: organizations with zero data retention (ZDR) enabled for Claude Code cannot link the Claude GitHub App at the organization level.

How to connect Claude Code to GitHub with /install-github-app

This setup puts Claude inside your repository. After it, a comment such as @claude fix the TypeError in the user dashboard component on an issue or pull request makes Claude analyze the code, implement changes and push commits. Claude replies in a comment on the same issue or pull request and updates it as it works.

You need admin access to the repository. /install-github-app works only with github.com repositories: if your remote is on gitlab.com or bitbucket.org, the command prints a notice and exits.

Quick setup

  1. Install the GitHub CLI (cli.github.com) and, if you aren't signed in, run gh auth login.
  2. In the repository you want to connect, run claude, then at the prompt run /install-github-app.
  3. When the Claude GitHub App page opens in your browser, install the app and give it access to your repository. Return to Claude Code and press Enter.
  4. Select Set up GitHub Actions workflows. You can deselect the @claude mentions workflow or the pull request review workflow if you don't want both.
  5. Choose a credential: a long-lived token created with your Claude subscription, or a pasted API key. Claude Code saves it as a repository secret named CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY.
  6. Review the planned changes and select Yes, make these changes.
  7. Claude Code pushes a branch with the workflow files and opens GitHub with a pull request ready to create. Create and merge it to turn the workflows on.

Then test it by tagging @claude in an issue comment.

Manual setup

Use this when you don't run Claude Code locally, when the command fails, or when you want full control of the workflow files. Install the Claude GitHub App (github.com/apps/claude) on the repository, add a secret, and copy a workflow file.

The action relies on three of the app's permissions: Contents, Issues and Pull requests, each read and write. Add one of these as a repository secret:

  • ANTHROPIC_API_KEY: an API key from the Claude Console.
  • CLAUDE_CODE_OAUTH_TOKEN: a token tied to your Claude subscription (Pro, Max, Ultra, Team or Enterprise), generated by running claude setup-token locally.

Then copy examples/claude.yml from the anthropics/claude-code-action repository into .github/workflows/. The core of the workflow, as shown in the Claude Code docs, looks like this:

name: Claude Code
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
jobs:
  claude:
    if: contains(github.event.comment.body, '@claude')
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
      issues: write
      id-token: write
      actions: read
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 1
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

If you saved the OAuth token instead, replace the anthropic_api_key line with claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}. Never paste a key into the workflow file itself: always reference it as a secret.

What to know before you install the app

GitHub does not let you accept a subset of an app's permissions, and the Claude GitHub App is shared by several Claude features, so its permission set is wider than the action needs. It includes Actions (read and write), Administration (read), Workflows (read and write) and others. If your organization allows only Contents, Issues and Pull requests, the docs describe creating a custom GitHub App for the action instead.

Each run uses GitHub Actions minutes on GitHub-hosted runners. It also uses API tokens, or your Claude subscription if you authenticated with the OAuth token. Specific requests, a short CLAUDE.md and a --max-turns value in claude_args all reduce cost.

How to connect GitHub for Claude Code cloud sessions

Cloud sessions run Claude Code on Anthropic's infrastructure from claude.ai/code, the Claude mobile app, the Desktop app or claude --cloud. They need access to your repositories to clone code and push branches. The documentation lists two ways to grant it:

MethodHowRepositories reachable
GitHub AppAuthorize the Claude GitHub App during web onboardingAny public repository, plus private ones the app is installed on
/web-setupRun it in your terminal to send your local gh CLI token to your Claude accountAny repository your gh token can access

Cloud sessions are available on Pro, Max, Ultra and Team plans, and for Enterprise users with premium seats or Chat + Claude Code seats. Installing the GitHub App on a repository also enables auto-fix for pull requests in it, where Claude responds to CI failures and review comments. /web-setup alone does not give you that.

Once connected, start a task from your terminal inside the repository:

claude --cloud "Fix the authentication bug in src/auth/login.ts"

The cloud session clones your current directory's GitHub remote at your current branch, not your local checkout, so push any local commits first. If the terminal prints Branch <name> is not on GitHub, the session started from a different commit, and unpushed work is not in it.

For more on the terminal tool itself, see What is Claude CLI? Claude Code in the terminal explained. If you work in an editor, Claude Code in VS Code covers that setup. For the Git side, how to push to GitHub explains the push step that cloud sessions depend on.

If Claude does not respond to @claude

The Claude Code documentation lists these checks, in roughly this order:

  • The GitHub App is installed on the repository.
  • Workflows are enabled for the repository.
  • Your API key or OAuth token is set in the repository secrets.
  • The comment contains @claude as a complete word, not /claude or @claude-bot.
  • The commenting user has write access. The action rejects triggers from users without it, and from bot accounts unless they are listed in allowed_bots.

A separate problem: CI may not run on Claude's commits. GitHub does not trigger workflows on commits made with the default GITHUB_TOKEN. If you passed github_token: ${{ secrets.GITHUB_TOKEN }} to the action, remove it so the action authenticates as the Claude GitHub App.

If a private repository doesn't appear in claude.ai, go back to the private repository section above: the cause is nearly always missing app access or SSO authorization, not a fault in Claude.

Frequently asked questions

Can Claude read my private GitHub repositories?
Yes, once the Claude GitHub App has been granted access to them. A GitHub administrator can allow all repositories or only specific ones. If your organization uses SSO, each user may also need to authorize the Claude app for that organization at github.com/settings/applications before private repositories appear.
Does Claude see my commit history and pull requests when I add a repository in chat?
No. The claude.ai integration syncs only file names and file contents from the branch you pick. Commit history, pull requests and other metadata are not retrieved.
What does the @claude mention in GitHub need to work?
The Claude GitHub App installed on the repository, an authentication secret (ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN) saved in the repository's secrets, and a workflow file such as claude.yml in .github/workflows/. The person who mentions @claude must also have write access to the repository.
Do I need admin rights on the repository?
For the GitHub Actions setup, yes: the Claude Code documentation says you need admin access to the repository for both quick and manual setup. Adding files from a repository in claude.ai only needs read access to that repository.

Sources