{
    "content": [
        {
            "type": "text",
            "text": "# git-remote (man)\n\n## NAME\n\ngit-remote - Manage set of tracked repositories\n\n## SYNOPSIS\n\ngit remote [-v | --verbose]\ngit remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=(fetch|push)] <name> <url>\ngit remote rename <old> <new>\ngit remote remove <name>\ngit remote set-head <name> (-a | --auto | -d | --delete | <branch>)\ngit remote set-branches [--add] <name> <branch>...\ngit remote get-url [--push] [--all] <name>\ngit remote set-url [--push] <name> <newurl> [<oldurl>]\ngit remote set-url --add [--push] <name> <newurl>\ngit remote set-url --delete [--push] <name> <url>\ngit remote [-v | --verbose] show [-n] <name>...\ngit remote prune [-n | --dry-run] <name>...\ngit remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]\n\n## DESCRIPTION\n\nManage the set of repositories (\"remotes\") whose branches you track.\n\n## TLDR\n\n> Manage set of tracked repositories (\"remotes\").\n\n- List existing remotes with their names and URLs:\n  `git remote {{-v|--verbose}}`\n- Show information about a remote:\n  `git remote show {{remote_name}}`\n- Add a remote:\n  `git remote add {{remote_name}} {{remote_url}}`\n- Change the URL of a remote (use `--add` to keep the existing URL):\n  `git remote set-url {{remote_name}} {{new_url}}`\n- Show the URL of a remote:\n  `git remote get-url {{remote_name}}`\n- Remove a remote:\n  `git remote remove {{remote_name}}`\n- Rename a remote:\n  `git remote rename {{old_name}} {{new_name}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (1 subsections)\n- **COMMANDS**\n- **DISCUSSION**\n- **EXIT STATUS**\n- **EXAMPLES**\n- **SEE ALSO**\n- **GIT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "git-remote",
        "section": "",
        "mode": "man",
        "summary": "git-remote - Manage set of tracked repositories",
        "synopsis": "git remote [-v | --verbose]\ngit remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=(fetch|push)] <name> <url>\ngit remote rename <old> <new>\ngit remote remove <name>\ngit remote set-head <name> (-a | --auto | -d | --delete | <branch>)\ngit remote set-branches [--add] <name> <branch>...\ngit remote get-url [--push] [--all] <name>\ngit remote set-url [--push] <name> <newurl> [<oldurl>]\ngit remote set-url --add [--push] <name> <newurl>\ngit remote set-url --delete [--push] <name> <url>\ngit remote [-v | --verbose] show [-n] <name>...\ngit remote prune [-n | --dry-run] <name>...\ngit remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]",
        "tldr_summary": "Manage set of tracked repositories (\"remotes\").",
        "tldr_examples": [
            {
                "description": "List existing remotes with their names and URLs",
                "command": "git remote {{-v|--verbose}}"
            },
            {
                "description": "Show information about a remote",
                "command": "git remote show {{remote_name}}"
            },
            {
                "description": "Add a remote",
                "command": "git remote add {{remote_name}} {{remote_url}}"
            },
            {
                "description": "Change the URL of a remote (use `--add` to keep the existing URL)",
                "command": "git remote set-url {{remote_name}} {{new_url}}"
            },
            {
                "description": "Show the URL of a remote",
                "command": "git remote get-url {{remote_name}}"
            },
            {
                "description": "Remove a remote",
                "command": "git remote remove {{remote_name}}"
            },
            {
                "description": "Rename a remote",
                "command": "git remote rename {{old_name}} {{new_name}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-v",
                "long": "--verbose",
                "arg": null,
                "description": "Be a little more verbose and show remote url after name. NOTE: This must be placed between remote and subcommand."
            }
        ],
        "examples": [
            "•   Add a new remote, fetch, and check out a branch from it",
            "$ git remote",
            "origin",
            "$ git branch -r",
            "origin/HEAD -> origin/master",
            "origin/master",
            "$ git remote add staging git://git.kernel.org/.../gregkh/staging.git",
            "$ git remote",
            "origin",
            "staging",
            "$ git fetch staging",
            "...",
            "From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging",
            "* [new branch]      master     -> staging/master",
            "* [new branch]      staging-linus -> staging/staging-linus",
            "* [new branch]      staging-next -> staging/staging-next",
            "$ git branch -r",
            "origin/HEAD -> origin/master",
            "origin/master",
            "staging/master",
            "staging/staging-linus",
            "staging/staging-next",
            "$ git switch -c staging staging/master",
            "...",
            "•   Imitate git clone but track only selected branches",
            "$ mkdir project.git",
            "$ cd project.git",
            "$ git init",
            "$ git remote add -f -t master -m master origin git://example.com/git.git/",
            "$ git merge origin"
        ],
        "see_also": [
            {
                "name": "git-fetch",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-fetch/1/json"
            },
            {
                "name": "git-branch",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-branch/1/json"
            },
            {
                "name": "git-config",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-config/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-v, --verbose",
                        "lines": 3,
                        "flag": "-v",
                        "long": "--verbose"
                    }
                ]
            },
            {
                "name": "COMMANDS",
                "lines": 127,
                "subsections": []
            },
            {
                "name": "DISCUSSION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "EXIT STATUS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 36,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "git-remote - Manage set of tracked repositories\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "git remote [-v | --verbose]\ngit remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=(fetch|push)] <name> <url>\ngit remote rename <old> <new>\ngit remote remove <name>\ngit remote set-head <name> (-a | --auto | -d | --delete | <branch>)\ngit remote set-branches [--add] <name> <branch>...\ngit remote get-url [--push] [--all] <name>\ngit remote set-url [--push] <name> <newurl> [<oldurl>]\ngit remote set-url --add [--push] <name> <newurl>\ngit remote set-url --delete [--push] <name> <url>\ngit remote [-v | --verbose] show [-n] <name>...\ngit remote prune [-n | --dry-run] <name>...\ngit remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Manage the set of repositories (\"remotes\") whose branches you track.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-v, --verbose",
                        "content": "Be a little more verbose and show remote url after name. NOTE: This must be placed\nbetween remote and subcommand.\n",
                        "flag": "-v",
                        "long": "--verbose"
                    }
                ]
            },
            "COMMANDS": {
                "content": "With no arguments, shows a list of existing remotes. Several subcommands are available to\nperform operations on the remotes.\n\nadd\nAdd a remote named <name> for the repository at <url>. The command git fetch <name> can\nthen be used to create and update remote-tracking branches <name>/<branch>.\n\nWith -f option, git fetch <name> is run immediately after the remote information is set\nup.\n\nWith --tags option, git fetch <name> imports every tag from the remote repository.\n\nWith --no-tags option, git fetch <name> does not import tags from the remote repository.\n\nBy default, only tags on fetched branches are imported (see git-fetch(1)).\n\nWith -t <branch> option, instead of the default glob refspec for the remote to track all\nbranches under the refs/remotes/<name>/ namespace, a refspec to track only <branch> is\ncreated. You can give more than one -t <branch> to track multiple branches without\ngrabbing all branches.\n\nWith -m <master> option, a symbolic-ref refs/remotes/<name>/HEAD is set up to point at\nremote’s <master> branch. See also the set-head command.\n\nWhen a fetch mirror is created with --mirror=fetch, the refs will not be stored in the\nrefs/remotes/ namespace, but rather everything in refs/ on the remote will be directly\nmirrored into refs/ in the local repository. This option only makes sense in bare\nrepositories, because a fetch would overwrite any local commits.\n\nWhen a push mirror is created with --mirror=push, then git push will always behave as if\n--mirror was passed.\n\nrename\nRename the remote named <old> to <new>. All remote-tracking branches and configuration\nsettings for the remote are updated.\n\nIn case <old> and <new> are the same, and <old> is a file under $GITDIR/remotes or\n$GITDIR/branches, the remote is converted to the configuration file format.\n\nremove, rm\nRemove the remote named <name>. All remote-tracking branches and configuration settings\nfor the remote are removed.\n\nset-head\nSets or deletes the default branch (i.e. the target of the symbolic-ref\nrefs/remotes/<name>/HEAD) for the named remote. Having a default branch for a remote is\nnot required, but allows the name of the remote to be specified in lieu of a specific\nbranch. For example, if the default branch for origin is set to master, then origin may\nbe specified wherever you would normally specify origin/master.\n\nWith -d or --delete, the symbolic ref refs/remotes/<name>/HEAD is deleted.\n\nWith -a or --auto, the remote is queried to determine its HEAD, then the symbolic-ref\nrefs/remotes/<name>/HEAD is set to the same branch. e.g., if the remote HEAD is pointed\nat next, git remote set-head origin -a will set the symbolic-ref refs/remotes/origin/HEAD\nto refs/remotes/origin/next. This will only work if refs/remotes/origin/next already\nexists; if not it must be fetched first.\n\nUse <branch> to set the symbolic-ref refs/remotes/<name>/HEAD explicitly. e.g., git\nremote set-head origin master will set the symbolic-ref refs/remotes/origin/HEAD to\nrefs/remotes/origin/master. This will only work if refs/remotes/origin/master already\nexists; if not it must be fetched first.\n\nset-branches\nChanges the list of branches tracked by the named remote. This can be used to track a\nsubset of the available remote branches after the initial setup for a remote.\n\nThe named branches will be interpreted as if specified with the -t option on the git\nremote add command line.\n\nWith --add, instead of replacing the list of currently tracked branches, adds to that\nlist.\n\nget-url\nRetrieves the URLs for a remote. Configurations for insteadOf and pushInsteadOf are\nexpanded here. By default, only the first URL is listed.\n\nWith --push, push URLs are queried rather than fetch URLs.\n\nWith --all, all URLs for the remote will be listed.\n\nset-url\nChanges URLs for the remote. Sets first URL for remote <name> that matches regex <oldurl>\n(first URL if no <oldurl> is given) to <newurl>. If <oldurl> doesn’t match any URL, an\nerror occurs and nothing is changed.\n\nWith --push, push URLs are manipulated instead of fetch URLs.\n\nWith --add, instead of changing existing URLs, new URL is added.\n\nWith --delete, instead of changing existing URLs, all URLs matching regex <url> are\ndeleted for remote <name>. Trying to delete all non-push URLs is an error.\n\nNote that the push URL and the fetch URL, even though they can be set differently, must\nstill refer to the same place. What you pushed to the push URL should be what you would\nsee if you immediately fetched from the fetch URL. If you are trying to fetch from one\nplace (e.g. your upstream) and push to another (e.g. your publishing repository), use two\nseparate remotes.\n\nshow\nGives some information about the remote <name>.\n\nWith -n option, the remote heads are not queried first with git ls-remote <name>; cached\ninformation is used instead.\n\nprune\nDeletes stale references associated with <name>. By default, stale remote-tracking\nbranches under <name> are deleted, but depending on global configuration and the\nconfiguration of the remote we might even prune local tags that haven’t been pushed\nthere. Equivalent to git fetch --prune <name>, except that no new references will be\nfetched.\n\nSee the PRUNING section of git-fetch(1) for what it’ll prune depending on various\nconfiguration.\n\nWith --dry-run option, report what branches would be pruned, but do not actually prune\nthem.\n\nupdate\nFetch updates for remotes or remote groups in the repository as defined by\nremotes.<group>. If neither group nor remote is specified on the command line, the\nconfiguration parameter remotes.default will be used; if remotes.default is not defined,\nall remotes which do not have the configuration parameter remote.<name>.skipDefaultUpdate\nset to true will be updated. (See git-config(1)).\n\nWith --prune option, run pruning against all the remotes that are updated.\n",
                "subsections": []
            },
            "DISCUSSION": {
                "content": "The remote configuration is achieved using the remote.origin.url and remote.origin.fetch\nconfiguration variables. (See git-config(1)).\n",
                "subsections": []
            },
            "EXIT STATUS": {
                "content": "On success, the exit status is 0.\n\nWhen subcommands such as add, rename, and remove can’t find the remote in question, the exit\nstatus is 2. When the remote already exists, the exit status is 3.\n\nOn any other error, the exit status may be any other non-zero value.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "•   Add a new remote, fetch, and check out a branch from it\n\n$ git remote\norigin\n$ git branch -r\norigin/HEAD -> origin/master\norigin/master\n$ git remote add staging git://git.kernel.org/.../gregkh/staging.git\n$ git remote\norigin\nstaging\n$ git fetch staging\n...\nFrom git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging\n* [new branch]      master     -> staging/master\n* [new branch]      staging-linus -> staging/staging-linus\n* [new branch]      staging-next -> staging/staging-next\n$ git branch -r\norigin/HEAD -> origin/master\norigin/master\nstaging/master\nstaging/staging-linus\nstaging/staging-next\n$ git switch -c staging staging/master\n...\n\n\n•   Imitate git clone but track only selected branches\n\n$ mkdir project.git\n$ cd project.git\n$ git init\n$ git remote add -f -t master -m master origin git://example.com/git.git/\n$ git merge origin\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "git-fetch(1) git-branch(1) git-config(1)\n",
                "subsections": []
            },
            "GIT": {
                "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                                GIT-REMOTE(1)",
                "subsections": []
            }
        }
    }
}