How to Push Code to no-mistakes Instead of Origin: Fork Configuration Guide
Configure your fork URL using no-mistakes init --fork-url <your-fork-url> to route push operations to your personal fork while keeping pull requests and CI validation tied to the upstream repository.
The no-mistakes tool implements a dual-remote architecture that lets you push code to a personal fork while maintaining the security boundaries of the upstream repository. This workflow stores two distinct Git URLs in the internal database and automatically routes push operations to your fork when configured. Understanding how no-mistakes distinguishes between these remotes ensures you can contribute safely without accidentally pushing to the canonical repository.
Understanding the Fork Routing Architecture
The tool maintains two separate remote URLs for every managed repository, stored in internal/db/repo.go:
upstream_url: The canonical repository containing trusted CI configurations and PR targetsfork_url(optional): Your personal fork where push operations are directed
These values are stored in dedicated columns within the repository database table. When fork_url is populated, the push step in internal/pipeline/steps/host.go automatically redirects git push commands to this remote instead of the default origin.
Configuring Your Fork Remote
To begin pushing code to no-mistakes instead of origin, initialize the tool with the --fork-url flag:
no-mistakes init --fork-url https://github.com/yourusername/no-mistakes.git
This command, implemented in internal/cli/init.go, performs the following actions:
- Records the current directory's remote as
upstream_url - Stores the supplied URL in the
fork_urlcolumn ininternal/db/repo.go - Configures subsequent push operations to target the fork
If you need to update the fork URL later, re-run the init command with the new URL or use the repo set-fork sub-command if available in your CLI version.
How Push Operations Redirect to Your Fork
When the pipeline executes the host step, the logic in internal/pipeline/steps/host.go looks up the fork_url value before constructing the push command. As noted in the source code comments regarding "The push step may use fork_url", the tool builds a git push <fork_url> <branch> command when the fork URL is present. If fork_url is not set, the operation falls back to the default remote behavior.
This means after initialization, standard Git commands work as expected:
git checkout -b feature-branch
git commit -am "Add new feature"
git push
The final command automatically pushes to your fork URL rather than to the upstream origin.
Maintaining Upstream Security for PRs
While pushes target your fork, PR creation and CI operations intentionally ignore the fork_url setting. According to the Fork Routing policy documented in AGENTS.md, pull requests are always opened against the upstream_url repository. This design preserves the security model where:
- Only the upstream repository contains trusted configurations
- CI runs validate against the canonical codebase
- Personal forks remain isolated sandboxes for development work
Summary
no-mistakesuses two remotes:upstream_urlfor trusted operations andfork_urlfor pushes, defined ininternal/db/repo.go- Initialize with
--fork-url: Runno-mistakes init --fork-url <url>to start pushing to your fork instead of origin - Automatic redirection: The host step in
internal/pipeline/steps/host.goreadsfork_urland routesgit pushaccordingly - Upstream integrity: PRs and CI continue to target the upstream repository per the security model in
AGENTS.md
Frequently Asked Questions
What happens if I don't configure a fork URL?
If you run no-mistakes init without the --fork-url flag, the fork_url column remains empty in internal/db/repo.go. Push operations will target the default origin remote, meaning you will push directly to the upstream repository rather than to a personal fork.
Can I change my fork URL after initialization?
Yes. You can re-run no-mistakes init --fork-url <new-url> to update the stored value, or use the repo set-fork sub-command if your CLI version supports it. The change takes effect immediately for subsequent push operations.
Why do pull requests still target the upstream repository?
The tool intentionally ignores fork_url for PR creation to maintain the security boundaries described in AGENTS.md. This ensures that CI configurations and trusted settings are always read from the canonical upstream repository, preventing supply-chain attacks through compromised fork configurations.
Does this work with GitLab or other Git hosts?
Yes. The fork_url field accepts any valid Git remote URL. Whether you are using GitHub, GitLab, Bitbucket, or a self-hosted Git server, the push redirection logic in internal/pipeline/steps/host.go will route commits to whatever URL you provide during initialization.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →