Skip to content
한국어

Handing Off GitHub Repository Work to a Cloud Session: From a README Update to Going Live on the Web

In short
  • This is an exercise where you take one task from start to finish. It runs from “improve the README → pull request (PR) → merge → publish with GitHub Pages”. For a feature explanation of cloud sessions, see C13. Cloud sessions.
  • You pick a repository at claude.ai/code and make a request. Claude creates a working branch in the cloud and pushes it, then you read the diff and hand it off with Create PR.
  • You click merge yourself on GitHub. The step where a person reviews and merges is the safety net.
  • In the publishing step, you may hit the error “Branch “main” is not allowed to deploy to github-pages due to environment protection rules.“ We actually ran into this while building this site, and the three fixes are listed below.
  • There’s no separate charge for the cloud VM; it counts toward your plan usage.

What you’ll be able to do after this tutorial

Section titled “What you’ll be able to do after this tutorial”
  • Pick a repository in a cloud session and hand off a README improvement.
  • Read the resulting diff, pass along fixes as inline comments, and create a PR.
  • Merge the PR on GitHub and publish the merged content with GitHub Pages.
  • Find the cause and fix it when a deployment is rejected because of environment protection rules.
From README update to Pages deploymentA cloud session pushes a README change to a working branch, you create a pull request and merge it into main, and the push to main triggers GitHub Actions, which deploys to GitHub Pages.1. Cloud sessionEdit the README and push to a branchMy computer can be off2. Pull request (PR)Read the diff and Create PRThe step where I check it myself3. Merge into mainA push to main happensThe deploy workflow starts4. GitHub PagesActions output is published as a site

The structure of cloud sessions (your device, the cloud VM, GitHub), environments, and network levels are explained in C13. Here are just the terms you need for this exercise.

Term Meaning
Branch A line of work in a repository. Claude doesn’t edit main directly; it puts changes on a working branch.
Pull request (PR) A request that says “please merge this branch’s changes into main”. It’s the place where you read the changes (diff) and approve.
Merge The action of combining a PR’s changes into main.
Default branch The branch that serves as the base for PRs and commits. Usually main.
GitHub Pages A GitHub feature that publishes a repository’s static files at a web address.
Environment protection rules Rules on the github-pages environment that GitHub Pages deployments use, such as “which branches can deploy”.
0/8 done
  1. Connect GitHub (one time only)

    Go to claude.ai/code and log in with your claude.ai account. Follow the prompts to connect GitHub; you’ll be taken to the GitHub authorization screen and returned after you approve. If you’ve already connected, skip this.

    • Connecting alone lets you clone only public repositories. Private repositories work only where the Claude GitHub App is installed. If you belong to a GitHub organization, you may need the organization owner’s approval.
    • On Pro, Max, and Ultra, a Default environment is created automatically during onboarding. Default is enough for this exercise.
    • On Team and Enterprise, an organization Owner must have turned on the GitHub connector. If you see “GitHub access is required for Claude Code cloud sessions” on the login screen, contact your Owner.

    Screen guide: The GitHub connection screen at claude.ai/codeSee this screen in the official help ↗

  2. Pick a repository and branch, and start in Plan mode

    In the repository selector below the input box, pick your practice repository and leave the branch as main. In the permission mode near the input box, choose Plan. Cloud sessions offer three modes, Auto, Accept edits, and Plan, and there’s no Manual (Auto may not appear depending on organization settings and the model you chose).

    Plan mode is a mode where Claude proposes an approach and doesn’t edit files until you approve. For your first handed-off task, looking at the plan first reduces mistakes.

  3. Ask for the README improvement

    The more specific you make the task, the better. Include the file name, the items you want, and what not to do.

    Copy and paste this prompt

    Improve this repository’s README.md. First tell me what’s missing from the current README, then show me a plan to write up the following items in English. (1) A one-paragraph project introduction (2) A table of the file structure (3) How to view it on my computer (how to open index.html in a browser) (4) How to edit this page. Don’t change the code (index.html); edit README.md only. Don’t make up features that don’t exist; read the actual file contents and write from those.

    Claude clones the repository onto a cloud VM, reads the files, and tells you the plan. If the plan looks fine, approve it so it runs. You can watch the progress on screen, and the session keeps running even if you close the tab. When it finishes, Claude pushes the working branch to GitHub.

    Screen guide: The README improvement plan shown in plan modeSee this screen in the official help ↗

  4. Read the diff and leave comments

    When the task is done, there’s an indicator showing the number of lines added and removed, like +42 -18. Click it to open the diff view, which shows the file list on the left and the changes on the right. There are three things to check.

    • That only README.md changed (if other files like index.html changed, ask for them to be reverted)
    • That the file structure table lists only files that actually exist
    • That the “how to view it” instructions can actually be followed

    To fix something, select a line in the diff, type your comment, and press Enter. The comments are sent along with your next message. Then ask in chat, “Fix it according to my comments.”

    From checking the diff to creating a PR
    1. The finished sessionClick the indicator that shows line counts, like +42 -18→ The diff view opens
    2. Diff viewCheck the file list on the left and the changes on the right; select a line to fix, type a comment, and press Enter→ The comment is sent with your next message
    3. The Changes card in the panel next to the chatClick Create PR→ A PR is created with an automatically generated title and description. For a draft, right-click Create PR, choose Create draft PR, then click the button

    This is a simplified flow. See the official help page for the actual screens.

  5. Create the PR

    If the diff looks good, click Create PR on the Changes card in the panel next to the chat (if the panel is hidden, reopen it with the Show session rail icon in the session title bar). A PR is created with an automatically generated title and description. If you want to open it as a draft, right-click Create PR, choose Create draft PR, then click the button (as of 2026-10-26). A regular PR is enough for this exercise. The session stays alive after the PR is created, so you can paste in review comments or error messages and have it keep fixing things.

  6. Merge on GitHub

    On GitHub’s PR screen, read through Files changed one more time, then merge into main with the merge button. The button wording varies a little by repository settings; follow the on-screen instructions. We recommend keeping merging as a step you do yourself.

  7. Publish with GitHub Pages

    Click Settings under the repository name on GitHub (if you don’t see the tab, use the … dropdown), go to Pages in the sidebar’s “Code, planning, and automation” section, and set the Source under “Build and deployment”. You need repository admin or maintainer permissions.

    • Deploy from a branch: The simplest method. Pick a branch (main) and a folder (/ (root)) and click Save. You just need an index.html at the top level of the repository.
    • GitHub Actions: Use this for sites that need a build step (for example, a site built with Astro like this one). It needs a workflow file, and for Astro, the official docs cover .github/workflows/deploy.yml and the site and base settings in astro.config.mjs.

    Once you set the publishing source, a deployment runs. GitHub Pages always deploys through a GitHub Actions workflow run, so look at the run result in the repository’s Actions tab, and open the site address if it succeeds. The official docs don’t say how long it takes to appear, so if you don’t see it right away, check the Actions run result first (as of 2026-10-19).

    Choosing the GitHub Pages publishing source
    1. Under the GitHub repository nameClick Settings (if you don't see the tab, use the ... dropdown)
    2. Sidebar: Code, planning, and automationClick Pages→ The Build and deployment section appears
    3. Build and deploymentUnder Source, choose Deploy from a branch, pick branch main and folder / (root), then Save→ A deployment runs
    4. The repository's Actions tabCheck the run result. If it succeeds, click Visit site under Settings > Pages→ The site opens

    This is a simplified flow. See the official help page for the actual screens.

    Screen guide: The publishing source selection screen under Settings > PagesSee this screen in the official help ↗

  8. Clean up when you’re done

    You can archive or delete a session from the sidebar. If the PR you needed has already been merged, it’s fine to clean up.

Step Where What to click
Hand off the task claude.ai/code Repository selector, permission mode (Plan), input box
Review the diff A session at claude.ai/code Diff indicator, select a line and comment
Create the PR A session at claude.ai/code Create PR
Merge The PR screen on GitHub Merge button (wording varies by settings)
Publish The GitHub repository’s Settings > Pages Choose Source
Check the deployment The GitHub repository’s Actions tab Run result, Re-run

Permission modes in cloud sessions (as of 2026-10-26)

Section titled “Permission modes in cloud sessions (as of 2026-10-26)”
Mode Behavior
Auto A classifier reviews Claude’s actions. It may not appear depending on organization settings and the model
Accept edits Doesn’t stop until it makes the changes and pushes the branch
Plan Proposes an approach and doesn’t edit files until you approve
Manual, Bypass Not offered in cloud sessions
Order Where What to do
1 Settings > Default branch (General screen) Change the default branch to main (needs repository admin permission, and there must be at least two branches)
2 Settings > Environments > github-pages > Deployment branches and tags Add a rule that allows main
3 The failed run in the Actions tab Run it again with Re-run all jobs

The deployment is rejected: Branch "main" is not allowed to deploy to github-pages due to environment protection rules.

Section titled “The deployment is rejected: Branch "main" is not allowed to deploy to github-pages due to environment protection rules.”

We actually ran into this while building this site.

  • Situation: The branch first pushed to an empty repository became the default branch. A GitHub Pages deployment that started from main, created later, was rejected.
  • Cause: The branch allowed by the github-pages environment’s protection rules (here, the default branch first pushed) was different from main, which attempted the deployment. According to GitHub’s official docs, if the github-pages environment a workflow refers to doesn’t exist, it’s created automatically, and for environments created by implicit Pages builds such as branch or folder sources, the source branch is added as a protection rule. Check directly on the Environments screen which rules were created.
  • Fix 1: Change Settings > General > Default branch to main.
  • Fix 2: Add a main rule under Settings > Environments > github-pages > Deployment branches and tags. In the “Deployment branches” dropdown choose Selected branches and tags, click Add deployment branch or tag rule, set Ref type to Branch and the name to main, then click Add rule.
  • Fix 3: Re-run the failed run. In the Actions tab, open the failed run and click Re-run all jobs in the Re-run jobs dropdown (or the Re-run all jobs button when there are no failed jobs).
  • Usually you fix the rule with option 1 or 2, then run it again with option 3. If you only do option 3, you’ll get blocked by the same rule again.

I can’t see my repository at claude.ai/code

Section titled “I can’t see my repository at claude.ai/code”
  • Cause: For private repositories to appear, the Claude GitHub App must be installed on that account or organization, and the installation scope must include the repository.
  • Fix: Install the Claude GitHub App on that account. For an organization, ask the organization owner to install it or approve it. If you connected with /web-setup in the terminal, the repositories visible to your gh token appear.

The login screen only shows a GitHub login button

Section titled “The login screen only shows a GitHub login button”
  • Cause: Cloud sessions require a GitHub connection. On Team and Enterprise, an Owner must turn on the GitHub connector.
  • Fix: Go through the browser connection, or if you use the GitHub CLI (gh), run /web-setup in the terminal. On Team and Enterprise, /web-setup appears only if the Owner turned on Quick setup.

A push that edits a workflow file is rejected

Section titled “A push that edits a workflow file is rejected”
  • Cause: If the gh token you connected with /web-setup lacks the workflow scope, pushes that change GitHub Actions workflow files can be rejected.
  • Fix: Run gh auth refresh -s workflow in the terminal, then run /web-setup again.
  • Cause: Your request may not have set a scope.
  • Fix: Check the diff for unnecessary file changes and ask, “Revert any changes other than README.md.” Since it’s before the merge, main isn’t affected.
  • Write what not to do, too. Limiting the scope, like “don’t change the code, just the README”, keeps the diff small and the review easy.
  • One PR per task. Handing off several tasks at once makes the diff big and hard to read. Cloud sessions create a separate session and branch per task, so you can start independent tasks separately.
  • Merge it yourself. Even for a PR Claude made, it’s better for a person to merge. If you use default branch protection rules, leave them as they are.
  • Watch your usage. Running several tasks in parallel uses up your plan usage that much faster. See C2 for detailed limits.
  • Turn recurring checks into routines. For example, having it check weekly whether the README is up to date and open a PR can be handed off as a routine. Tutorial 10 covers this.

Sources

Last verified: Nov 16, 2026

Prices, limits, and menu names change often. Before making an important decision, check the official pages above for the latest details.