# How to Push Code to no-mistakes Instead of Origin: Fork Configuration Guide

> Learn to push code to no-mistakes instead of origin. Configure your fork URL to manage pushes effectively while maintaining upstream integrations. This guide simplifies your workflow.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-07-14

---

**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`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/db/repo.go):

- **`upstream_url`**: The canonical repository containing trusted CI configurations and PR targets
- **`fork_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`](https://github.com/kunchenguid/no-mistakes/blob/main/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:

```bash
no-mistakes init --fork-url https://github.com/yourusername/no-mistakes.git

```

This command, implemented in [`internal/cli/init.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/cli/init.go), performs the following actions:

1. Records the current directory's remote as `upstream_url`
2. Stores the supplied URL in the `fork_url` column in [`internal/db/repo.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/db/repo.go)
3. 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`](https://github.com/kunchenguid/no-mistakes/blob/main/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:

```bash
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`](https://github.com/kunchenguid/no-mistakes/blob/main/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-mistakes` uses two remotes**: `upstream_url` for trusted operations and `fork_url` for pushes, defined in [`internal/db/repo.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/db/repo.go)
- **Initialize with `--fork-url`**: Run `no-mistakes init --fork-url <url>` to start pushing to your fork instead of origin
- **Automatic redirection**: The host step in [`internal/pipeline/steps/host.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/host.go) reads `fork_url` and routes `git push` accordingly
- **Upstream integrity**: PRs and CI continue to target the upstream repository per the security model in [`AGENTS.md`](https://github.com/kunchenguid/no-mistakes/blob/main/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`](https://github.com/kunchenguid/no-mistakes/blob/main/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`](https://github.com/kunchenguid/no-mistakes/blob/main/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`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/host.go) will route commits to whatever URL you provide during initialization.