Claude + GitHub: The Three Integrations and How to Use Each

Claude connects to GitHub three different ways. Here's which one to use for code research, terminal commits, and automated PR review — with the exact setup as of June 2026.

TL;DR

“Connect Claude to GitHub” means three different things, and people mix them up constantly:

  1. The claude.ai GitHub connector — read-only. You attach specific files and folders to a chat so Claude can answer questions about your code. It syncs file names and contents only (no commit history, PRs, or issues). Free on every plan, still in beta as of June 2026.
  2. Claude Code in your terminal — read/write. It runs git and the GitHub CLI (gh) on your machine to stage commits and open PRs. Bundled with Claude Pro ($20/mo) and up.
  3. Claude Code GitHub Actions — runs on GitHub’s servers. Tag @claude in a PR or issue and it implements changes or reviews the diff. Setup is one command (/install-github-app); it bills against your Claude API key.

This guide covers all three, then goes deep on the one most people actually want first: using the connector as a grounded research tool over a codebase you don’t know yet.

Pick the right one

You want to…UseRead or writeWhere it runs
Ask “where is X” / “how does Y work”claude.ai connectorRead-onlyAnthropic servers
Have Claude edit files and open a PR for youClaude Code (terminal)Read/writeYour machine
Auto-review every PR, or @claude fix thisClaude Code ActionRead/writeGitHub runners

If you only remember one rule: the claude.ai connector cannot change your code. It reads files and answers. For anything that touches a branch, you need Claude Code (locally) or the GitHub Action (in CI).

Integration 1: the claude.ai GitHub connector

This is the “research tool over my own code” workflow, and it’s where most of the value-per-minute lives for someone learning a codebase. The hard part isn’t connecting — it’s getting grounded answers instead of confident nonsense.

Setup (June 2026)

  1. In a claude.ai chat, click the + button at the lower-left of the composer.
  2. Choose Add from GitHub. If you haven’t authorized GitHub yet, you’ll be redirected to authenticate.
  3. In the file browser, select specific files and folders — not the whole repo. Anthropic’s own guidance is to “include key files and directories that are central to your current task… but avoid selecting unnecessary files to keep within token limits.”
  4. Send your first message. Claude reads the selected contents and answers from them.

Two things worth knowing before you trust an answer:

  • Only file names and contents are synced, on one branch. The connector does not retrieve commit history, pull requests, or other metadata. So “summarize the last 5 commits” is out of scope — it has no commits to read.
  • After you push changes, click Sync now to refresh; the attached snapshot does not auto-update mid-conversation.

The connector is available on all plans (including Free) and is still labeled beta as of June 2026.

Make it grounded, not plausible

The default failure mode is a fluent answer with invented file paths. These habits kill that:

  • Open with a known-answer question. Ask something you can verify, like “Where is rate limiting implemented?”, before you trust anything you can’t verify. If it whiffs on a question you know, recalibrate immediately.
  • Force a file list first, then drill in. Prompt: List the 3-5 files most relevant to authentication with their paths, then stop. I'll pick one to walk through. Inventory before interpretation cuts drift.
  • Demand file:line references for every claim. Then open 2-3 in GitHub and check them. Vague summaries hide errors; concrete references expose them.
  • Anchor when it misroutes. Instead of arguing, point it at the file: “Look in src/api/rateLimit.ts specifically.” A correct hint beats three rounds of correction.

A 10-minute onboarding script

Run these against a module you wrote yourself first — your own familiarity is the hallucination detector.

  • Map it: What are the 5 most important files in this folder and what does each do? Include paths.
  • Trace it: Walk through how this module is invoked, starting from any HTTP route or job that triggers it. Give file:line refs for every step.
  • Pressure-test it: open every reference from the trace in GitHub. Mark each as correct, misrouted, or invented. Whatever made the answer wobble, fold into a tighter re-prompt and save the good version.

Integration 2: Claude Code in the terminal

When you want Claude to actually change code and open a PR, run Claude Code in your repo. It doesn’t use a special GitHub API — it shells out to your local git and the GitHub CLI (gh), so it operates with your own credentials and permissions.

Typical loop:

  • Ask for a change in natural language. Claude edits files in place.
  • It stages and writes a commit (default attribution includes a Co-Authored-By line for the model).
  • For the PR, it analyzes the commits on your branch, drafts a title and body covering the what and why, and runs gh pr create.

This path is read/write by definition and bundled into Claude Pro ($20/mo, which now includes Claude Code as of 2026), Max, and API access. Use it for real edits; use the connector above only for reading.

Integration 3: Claude Code GitHub Actions

This puts Claude on GitHub’s runners so it responds to events in your repo. Two patterns:

  • @claude mentions — tag @claude in any PR or issue comment and it reads the thread plus surrounding code, then implements the change or explains why it can’t.
  • Automatic PR review — run the code-review plugin on every pull_request so Claude reads the diff against your CLAUDE.md standards and posts inline comments without anyone tagging it.

One-command setup

From your terminal, in the repo, run:

/install-github-app

You must be a repo admin. It installs the Claude GitHub app (which requests read & write on Contents, Issues, and Pull requests), adds your ANTHROPIC_API_KEY to repository secrets, and drops a workflow file in .github/workflows/. Test it by tagging @claude in an issue comment.

The v1 config you’ll actually paste

As of June 2026 the action is at v1. A minimal @claude-responder workflow:

name: Claude Code
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
jobs:
  claude:
    runs-on: ubuntu-latest
    steps:
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

Notes that trip people up:

  • v1 auto-detects mode — there’s no more mode: "tag". If you’re upgrading from beta, change @beta to @v1, replace direct_prompt with prompt, and move model/max-turns/custom_instructions into a single claude_args block (e.g. claude_args: "--model claude-opus-4-7 --max-turns 10").
  • The action defaults to Sonnet 4.6. To run reviews on the stronger model, set --model claude-opus-4-7 in claude_args.
  • It honors CLAUDE.md at the repo root for code style and review criteria — keep that file concise and it shapes every response.

Costs to budget

  • API tokens bill against your ANTHROPIC_API_KEY per interaction. Community reports put small PR reviews (under ~100 lines) on Sonnet around $0.50–$2, with large diffs on complex repos reaching $5–$15. Opus is pricier per token (5/25 vs Sonnet’s 3/15 per 1M in/out as of June 2026) — reserve it for the reviews that matter.
  • GitHub Actions minutes are consumed by the runner separately from API cost. Cap runaway jobs with --max-turns and a workflow-level timeout-minutes.

FAQ

  • Can the claude.ai connector edit my code or open PRs? No. It’s read-only and syncs file contents only. For edits, use Claude Code in the terminal; for in-repo automation, use the GitHub Action.
  • Does the connector see my commit history or PRs? No. Per Anthropic’s docs it syncs file names and contents on one branch and explicitly does not retrieve commit history, PRs, or other metadata. Use @claude in an actual PR (the Action) if you need PR context.
  • Which plans include each integration? The connector works on every plan including Free. Claude Code in the terminal is bundled with Claude Pro ($20/mo), Max, and API access. The GitHub Action runs on your ANTHROPIC_API_KEY (API billing), separate from your chat plan.
  • Why does it invent function names sometimes? Long answers spanning many files drift. Narrow the file selection, demand file:line refs, and re-ask. Mixing two repos in one chat is the most common trigger — it blends conventions and fabricates paths.
  • Does the connector cost extra tokens? It draws on your existing plan’s allowance; larger file selections consume more context per query, which is the real reason to attach only what the task needs.
  • Should I use Opus 4.7 or Sonnet 4.6 for PR review in the Action? Sonnet 4.6 is the default and handles most reviews well at lower cost. Set --model claude-opus-4-7 for security-sensitive or architecturally tricky diffs, where its higher SWE-bench score (87.6% vs ~80% for the field) earns the extra spend.

Common mistakes

  • Attaching the whole repo (or every repo) to a connector chat. It’s slow, blows the context budget, and dilutes accuracy. Attach the few files the task needs.
  • Trusting unsourced claims. If a claim has no file:line reference, treat it as a guess until you’ve checked one.
  • Mixing two repos or three PRs in one chat. Conventions bleed across them and Claude can’t tell whose problem is whose. One repo or one PR per conversation.
  • Asking the connector to do write operations. It can’t. The request will produce a plausible-sounding plan that nothing executed.
  • Forgetting to Sync now after pushing. The attached snapshot is frozen until you refresh, so answers can describe stale code.
  • Committing your API key. Always reference it as ${{ secrets.ANTHROPIC_API_KEY }} in the workflow; never inline it.

Tags: #Claude #Tutorial #Workflow #Claude Code