--- topic: remote-config source_keys: - git-scm-remote-docs - context7-git-htmldocs --- # Remote configuration Which remotes exist, where they point, and what they track. `rtk git remote show ` needs network access — use `-n` for cached data offline, or `rtk git remote -v`, which lists URLs without querying. ## Add, remove, rename, inspect - **Add**: `rtk git remote add `, or `-f` to fetch immediately - **Remove**: `rtk git remote remove ` — deletes the remote, all its tracking refs, and its config - **Rename**: `rtk git remote rename ` - **Inspect**: `rtk git remote -v` (URLs, offline) or `rtk git remote show ` (live tracking status) - **Effective URLs**: `rtk git remote get-url ` shows the URL after `insteadOf` rewrites; `rtk git remote get-url --push --all ` lists every push URL ## Tracking, mirroring, housekeeping - **Track one branch**: `rtk git remote add -t ` (repeatable); `--no-tags` suppresses tag import entirely - **Mirror**: `--mirror=fetch` mirrors all refs locally (bare repos only); `--mirror=push` makes every push behave like `--mirror` - **Prune stale tracking refs without fetching**: `rtk git remote prune `, with `--dry-run` to preview - **Default branch pointer**: `rtk git remote set-head -a` (auto-detect, needs a prior fetch), `... ` (explicit), `... -d` (delete `refs/remotes//HEAD`) ## `set-url` — full form ```bash rtk git remote set-url # replace the first fetch URL rtk git remote set-url # replace only the URL matching regex rtk git remote set-url --push # change push URL only (must point at same repo) rtk git remote set-url --add # add an extra push URL (push to multiple remotes) rtk git remote set-url --delete # remove URLs matching regex ``` `--push` changes only where pushes go — fetch and push URLs must still reference the same repository. For genuine fetch-from-A / push-to-B workflows, use two separate named remotes instead; `--push` cannot do this.