Handing Off GitHub Repository Work to a Cloud Session: From a README Update to Going Live on the Web
- 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.
Concepts to know first
Section titled “Concepts to know first”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”. |
Step-by-step guide
Section titled “Step-by-step guide”-
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 ↗
-
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.
-
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 promptImprove 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 ↗
-
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.htmlchanged, 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 - The finished sessionClick the indicator that shows line counts, like +42 -18→ The diff view opens
- 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
- 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.
- That only README.md changed (if other files like
-
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.
-
Merge on GitHub
On GitHub’s PR screen, read through Files changed one more time, then merge into
mainwith 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. -
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 anindex.htmlat 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.ymland thesiteandbasesettings inastro.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 - Under the GitHub repository nameClick Settings (if you don't see the tab, use the ... dropdown)
- Sidebar: Code, planning, and automationClick Pages→ The Build and deployment section appears
- Build and deploymentUnder Source, choose Deploy from a branch, pick branch main and folder / (root), then Save→ A deployment runs
- 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 ↗
- Deploy from a branch: The simplest method. Pick a branch (
-
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.
Quick reference
Section titled “Quick reference”Where each step of this exercise happens
Section titled “Where each step of this exercise happens”| 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 |
The 3 fixes for a deployment error
Section titled “The 3 fixes for a deployment error”| 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 |
Common sticking points
Section titled “Common sticking points”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-pagesenvironment’s protection rules (here, the default branch first pushed) was different frommain, which attempted the deployment. According to GitHub’s official docs, if thegithub-pagesenvironment 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
mainrule 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 tomain, 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-setupin the terminal, the repositories visible to yourghtoken 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-setupin the terminal. On Team and Enterprise,/web-setupappears 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
ghtoken you connected with/web-setuplacks theworkflowscope, pushes that change GitHub Actions workflow files can be rejected. - Fix: Run
gh auth refresh -s workflowin the terminal, then run/web-setupagain.
Claude changed more than I asked
Section titled “Claude changed more than I asked”- 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,
mainisn’t affected.
Practical tips
Section titled “Practical tips”- 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.
Next tutorials
Section titled “Next tutorials”- 10. Delegating recurring work to agents — automating regular checks with routines
- C13. Cloud sessions — the full reference on environments, networking, teleport, Auto-fix, and more
- 7. Building work web tools — making a page to publish
- Claude Code headless mode and GitHub Actions automation — when you want to automate with code
Sources
Last verified: Nov 16, 2026
- Claude pricing claude.com
- Get started with Claude Code in the cloud code.claude.com
- Use Claude Code in the cloud code.claude.com
- Automate work with scheduled tasks (formerly routines) code.claude.com
- Configuring a publishing source for your GitHub Pages site docs.github.com
- Managing environments for deployment docs.github.com
- Changing the default branch docs.github.com
- Re-running workflows and jobs docs.github.com
- Deploy your Astro Site to GitHub Pages (Astro official docs source) raw.githubusercontent.com
Prices, limits, and menu names change often. Before making an important decision, check the official pages above for the latest details.
Finished this tutorial?
Progress is saved only in this browser and never sent anywhere.