Code moves between machines with git, as it always has. This guide covers the other half: moving Morph's record (commits with their sessions, metrics and eval suites) between machines through a Morph remote. A Morph remote is a bare Morph repository, reached over SSH or by filesystem path. It is separate from your git remote.
For what a push carries, read SECURITY.md first.
ssh you@server
mkdir -p ~/repos/myproject.morph
morph init --bare ~/repos/myproject.morphA bare repository has no working tree and needs no git repository. SERVER-SETUP.md covers access and policy.
In the project, which already has git and morph init:
morph remote add origin you@server:repos/myproject.morph
morph push origin main
morph branch --set-upstream origin/mainmorph remote add accepts ssh://user@host[:port]/path, the scp-style
user@host:path, and a plain filesystem path.
Clone the code with git, then attach Morph and pull the history before you make a commit:
git clone <git-url> myproject && cd myproject
morph init
morph remote add origin you@server:repos/myproject.morph
morph pull origin main
morph branch --set-upstream origin/mainDo not use morph clone for a working copy. It creates a directory
with .morph/ and the files but no git repository. morph clone --bare is useful for seeding a second server from an existing one.
morph sync # behavioral history first
git pull # then the code
# work, then commit as usual
git commit -am "..."
git push origin main
morph push origin mainmorph sync fetches the configured upstream and fast-forwards the
current Morph branch. It does not touch the working tree.
Run morph sync before git pull. A Morph commit includes the id
of the machine that created it (morph_instance), so two machines that
mirror the same git commit produce different Morph hashes. If you
git pull first, the post-merge hook mirrors the incoming commits
locally, and the next morph sync or morph pull reports Diverged.
If you sync first, the hook finds the incoming commits already mirrored
and creates nothing.
A teammate works the same way with their own account on the server. A push that is not a fast-forward is rejected.
A Morph commit carries two identity fields:
author: the person. Mirrored commits take it from the git commit.morph commitresolves it from--author, thenMORPH_AUTHOR_NAME/MORPH_AUTHOR_EMAIL, thenmorph config user.name/user.email.morph_instance: the machine.morph initgenerates it and stores it in.morph/config.jsonunderagent.instance_id(for examplemorph-3f9a2c).
morph push origin main sends every object reachable from the branch
tip that the server does not have:
commit ──► tree ──► file blobs
├──► pipeline, eval suite
├──► parents (recursively)
└──► evidence_refs ──► runs ──► traces, artifacts
The server checks that the closure is complete before it moves the ref. Either everything lands and the ref moves, or nothing changes.
morph fetch is the reverse for every branch on the remote. It updates
refs/remotes/origin/<branch> and leaves local branches alone.
If two machines both add Morph commits to main, the second push is
rejected as non-fast-forward, and morph pull reports Diverged.
morph pull origin main --merge (or morph sync) starts a Morph merge
of the two tips; see MERGE.md. If it stops on conflicts:
# resolve the files, then
morph add <resolved-files>
morph merge --continue
morph push origin mainUNVERIFIED: how this Morph-side merge interacts with the git working
tree when git has already merged the same commits. The reliable way to
avoid the situation is the order above: morph sync, then git pull.
Each SSH session starts with a Hello exchange. The server replies:
{"version": "X.Y.Z", "protocol_version": 1, "repo_version": "0.5"}
If protocol_version differs from the client's, the client stops:
error: Incompatible remote: remote protocol_version=2, local protocol_version=1
Upgrade the older side.
If the server lists your branch in push_gated_branches, the pushed
commit must pass the server's policy before the ref moves:
error: push gate failed for branch 'main': commit is not certified
Certify the commit (morph certify --metrics-file …) and push again.
See SERVER-SETUP.md.
| Command | Purpose |
|---|---|
morph init --bare <path> |
Create a bare server repository |
morph remote add <name> <path-or-ssh-url> |
Register a remote |
morph remote list |
List remotes |
morph push <remote> <branch> |
Send the branch's closure; fast-forward only |
morph fetch <remote> |
Update refs/remotes/<remote>/* |
morph pull <remote> <branch> |
Fetch, then fast-forward; errors on divergence |
morph pull <remote> <branch> --merge |
Fetch, then merge on divergence |
morph branch --set-upstream <remote>/<branch> |
Set the upstream that morph sync uses |
morph sync [branch] |
Fetch and fast-forward (or merge) from the upstream |
| Variable | Default | Use |
|---|---|---|
MORPH_SSH |
ssh |
The SSH binary used for transport |
MORPH_REMOTE_BIN |
morph |
The morph binary to run on the server, if it is not on the server's $PATH |
"Diverged: branch 'main' at … has diverged from remote tip …"
Most often you ran git pull before morph sync. See "Divergence".
"no upstream configured for 'main'"
Run morph branch --set-upstream origin/main.
"Incompatible remote: remote protocol_version=2, local protocol_version=1" Upgrade the older side.
"push gate failed for branch 'main': …" The server gates this branch. Certify the commit and retry.
"failed to spawn ssh"
ssh is not on $PATH, or the connection failed. Try it by hand:
ssh user@host morph remote-helper --repo-root /abs/path/to/bare. If
the subcommand does not exist on the server, its Morph is too old.
Filesystem remote on a shared drive
morph remote add origin /mnt/shared/myproject.morph works without
SSH. Both machines need read and write access to the directory.