---
title: "How to run Claude Code on two machines on the same repo · Cork"
description: "Run Claude Code on a laptop and a desktop against one repo: what syncs through git, what stays local, and how to move sessions and context between machines."
canonical: "https://corkcli.com/blog/claude-code-two-machines-same-repo"
last_updated: "2026-11-14"
published: "2026-10-03"
author: "Kevin Vera"
---

# How to run Claude Code on two machines on the same repo

Run Claude Code on a laptop and a desktop against one repo: what syncs through git, what stays local, and how to move sessions and context between machines.

By Kevin Vera · October 3, 2026 · [Guides](https://corkcli.com/blog/c/guides) · 6 min read

To run Claude Code on two machines on the same repo, treat git as the only thing that syncs: each machine has its own clone, agents work on separate branches, and you push and pull often. Everything Claude Code keeps outside the repository stays on the machine where it was made, including session transcripts and auto memory, so put shared instructions in committed files (`CLAUDE.md`, `.mcp.json`, `.claude/settings.json`). To continue a conversation elsewhere, use Remote Control to drive the original machine, or start the work as a cloud session and pull it down with `claude --teleport`.

## What syncs between machines and what does not

As of October 2026, this is how Claude Code's state is split. Plan around the right-hand column.

| Shared through git (if committed) | Stays on each machine |
|---|---|
| `CLAUDE.md` or `.claude/CLAUDE.md` (project instructions) | Session transcripts in `~/.claude/projects/<project>/` |
| `.claude/settings.json` (permissions, hooks) | Auto memory in `~/.claude/projects/<project>/memory/` |
| `.mcp.json` (project-scope MCP servers) | `CLAUDE.local.md` (personal, gitignored) |
| `.claude/agents/` (project subagents) | `~/.claude/settings.json`, user subagents, local-scope MCP servers in `~/.claude.json` |

The memory docs are explicit: "Auto memory is machine-local... Files are not shared across machines or cloud environments." And `claude --resume` reopens conversations from "this machine's local history," so a session started on your desktop does not appear in your laptop's picker.

## Step 1: one clone per machine, one branch per agent

Clone the repository on each machine. Do not point two machines at the same working directory through a file-sync service or network share; git checkouts and agents writing at the same time are a poor fit for that. Give every agent on every machine its own branch:

```bash
# desktop
claude --worktree desktop-search

# laptop
claude --worktree laptop-onboarding
```

`--worktree` creates a branch named `worktree-<name>`, so names stay distinct across machines as long as you pick distinct names.

## Step 2: push and pull on a short cycle

The machines only learn about each other through the remote. Before starting an agent, pull. When an agent reaches a stable point, commit and push its branch. Before landing, rebase onto the latest main and run the tests:

```bash
git fetch origin
git rebase origin/main
# run tests
git push
```

Small, frequent pushes keep the gap between machines short. A branch that lives for two days on a laptop is where the surprising conflicts come from.

## Step 3: commit the instructions both machines need

Anything Claude should know on both machines has to be in the repo:

- Build and test commands, conventions and architecture notes in `CLAUDE.md`. If the repo already has an `AGENTS.md`, recent Claude Code versions read it when there is no `CLAUDE.md`, or you can import it with an `@AGENTS.md` line.
- Shared MCP servers in `.mcp.json`, added with `claude mcp add --scope project`.
- Project subagents in `.claude/agents/`.

Learnings that live only in auto memory will not follow you. If Claude learns something on one machine that the other needs, ask it to "add this to CLAUDE.md" and commit it.

## Step 4: continue a conversation from the other machine

You have three options, depending on where the session should run.

**Drive the original machine remotely.** Remote Control connects claude.ai/code or the Claude app to a session running on your machine. Start it with `claude --remote-control` (or `/remote-control` inside a session). The session keeps running locally; the browser or phone is a window into it, so the original computer has to stay on. It requires a Pro, Max, Team or Enterprise plan with a claude.ai login; API keys are not supported.

**Run it in the cloud, then pull it down.** `claude --cloud "task"` starts a cloud session from your current repository's GitHub remote and branch, so push first. Later, from a checkout of the same repository on any machine, `claude --teleport` pulls the session and its branch into your terminal. Teleport needs a clean working tree, the session's branch pushed, and the same claude.ai account. The handoff is one-way from the CLI: you cannot push an existing terminal session to the cloud.

**Message a session on the other machine.** Cross-session messaging can reach your sessions on other machines when both are connected to Remote Control. Messages are plain text and travel through Anthropic's servers. Useful for "I just pushed the schema change, rebase before you continue."

## Step 5: know what neither machine sees

Even with all of this, the agent on your laptop has no idea what the agent on your desktop is editing right now. It sees the desktop's work only after a push and a pull. If both touch the same module, you find out at rebase time.

## How Cork helps

That last gap is what Cork closes. Cork is the [coordination layer](https://corkcli.com/blog/coordination-layer-ai-coding-agents) for multiplayer coding agents: it keeps Claude Code, Codex and Cursor agents, on one machine or across a team's machines, from overwriting each other on one codebase, and hands each agent what the others already learned.

For two machines specifically (agents on different machines seeing each other is the paid plan):

- **Live awareness across machines:** when an agent on one machine renames a function or changes a signature that an agent on the other depends on, the second agent hears it on its next step, before either has pushed.
- **[Write gate](https://corkcli.com/blog/write-gate):** an edit against code another agent is changing right now is held until your agent has their version.
- **Briefing:** each agent starts with the exact signatures, callers and recent changes of the code it is about to touch, which partly makes up for machine-local memory.
- **Shared knowledge and notes:** `remember` and `recall` store durable notes anchored to code, and on the paid plan, knowledge is shared rather than stuck on one machine.
- **Landing:** `git push` becomes one step that rebases onto teammates' commits, reruns the tests and pushes.

On a single machine, Cork Free covers unlimited agents and repos with no account. Install it on each machine:

```bash
curl -fsSL https://corkcli.com/install.sh | sh
```

## Frequently asked questions

### Can I resume a Claude Code session on another computer?

Not with `claude --resume`, which reads local history. Use Remote Control to drive the original machine, or start the work as a cloud session and pull it down with `claude --teleport`.

### Does Claude Code's memory sync between my laptop and desktop?

No. Auto memory is machine-local. Committed `CLAUDE.md` and `AGENTS.md` files travel with the repository.

### Can two machines share one Claude Code worktree?

Keep one clone per machine and sync through git. Sharing one working directory between machines invites half-written files and broken git state.

### How do I keep MCP servers the same on both machines?

Add them at project scope (`claude mcp add --scope project ...`), which writes `.mcp.json` in the repository root, and commit it.

## Sources

- <https://code.claude.com/docs/en/memory>
- <https://code.claude.com/docs/en/sessions>
- <https://code.claude.com/docs/en/remote-control>
- <https://code.claude.com/docs/en/claude-code-on-the-web>
- <https://code.claude.com/docs/en/cross-session-messaging>
- <https://code.claude.com/docs/en/mcp>
- <https://code.claude.com/docs/en/worktrees>

## Related reading

- [How to share context between Codex and Claude Code](https://corkcli.com/blog/share-context-codex-claude-code): Make Codex and Claude Code work from the same context: one AGENTS.md, shared MCP servers, handoff files, and live awareness when both edit the same repo.
- [Claude Code agent teams vs separate sessions on one repo](https://corkcli.com/blog/claude-code-agent-teams-vs-separate-sessions): Claude Code agent teams vs separate sessions on one repo: how each works, token cost, same-file conflicts, worktrees, and when to pick which (October 2026).
- [How to coordinate Cursor and Claude Code on the same codebase](https://corkcli.com/blog/coordinate-cursor-and-claude-code-same-codebase): Run Cursor and Claude Code on one repo without clobbered edits: shared AGENTS.md instructions, worktrees, shared MCP servers, hooks, and a coordination layer.
- [How to hand work from one AI coding agent to another](https://corkcli.com/blog/hand-off-work-between-ai-coding-agents): Hand off work between AI coding agents without losing context: commit, write a handoff note, resume or fork sessions in Claude Code and Codex, and verify first.

[All articles](https://corkcli.com/blog.md) · [Cork in Markdown](https://corkcli.com/index.md) · [llms.txt](https://corkcli.com/llms.txt)

This page in HTML: https://corkcli.com/blog/claude-code-two-machines-same-repo
