{
    "content": [
        {
            "type": "text",
            "text": "# git-remote (info)\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## 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": "info",
        "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": null,
        "tldr_examples": [],
        "tldr_source": null,
        "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": [
            "o   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",
            "...",
            "o   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": 14,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-v, --verbose",
                        "lines": 3,
                        "flag": "-v",
                        "long": "--verbose"
                    }
                ]
            },
            {
                "name": "COMMANDS",
                "lines": 151,
                "subsections": []
            },
            {
                "name": "DISCUSSION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "EXIT STATUS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 3,
                "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",
                "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\nmust be placed between remote and subcommand.\n",
                        "flag": "-v",
                        "long": "--verbose"
                    }
                ]
            },
            "COMMANDS": {
                "content": "With no arguments, shows a list of existing remotes. Several\nsubcommands are available to perform operations on the remotes.\n\nadd\nAdd a remote named <name> for the repository at <url>. The command\ngit fetch <name> can then be used to create and update\nremote-tracking branches <name>/<branch>.\n\nWith -f option, git fetch <name> is run immediately after the\nremote information is set up.\n\nWith --tags option, git fetch <name> imports every tag from the\nremote repository.\n\nWith --no-tags option, git fetch <name> does not import tags from\nthe remote repository.\n\nBy default, only tags on fetched branches are imported (see git-\nfetch(1)).\n\nWith -t <branch> option, instead of the default glob refspec for\nthe remote to track all branches under the refs/remotes/<name>/\nnamespace, a refspec to track only <branch> is created. You can\ngive 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\nset up to point at remote's <master> branch. See also the set-head\ncommand.\n\nWhen a fetch mirror is created with --mirror=fetch, the refs will\nnot be stored in the refs/remotes/ namespace, but rather everything\nin refs/ on the remote will be directly mirrored into refs/ in the\nlocal 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\nwill always behave as if --mirror was passed.\n\nrename\nRename the remote named <old> to <new>. All remote-tracking\nbranches and configuration settings for the remote are updated.\n\nIn case <old> and <new> are the same, and <old> is a file under\n$GITDIR/remotes or $GITDIR/branches, the remote is converted to\nthe configuration file format.\n\nremove, rm\nRemove the remote named <name>. All remote-tracking branches and\nconfiguration settings for the remote are removed.\n\nset-head\nSets or deletes the default branch (i.e. the target of the\nsymbolic-ref refs/remotes/<name>/HEAD) for the named remote. Having\na default branch for a remote is not required, but allows the name\nof the remote to be specified in lieu of a specific branch. For\nexample, if the default branch for origin is set to master, then\norigin may be specified wherever you would normally specify\norigin/master.\n\nWith -d or --delete, the symbolic ref refs/remotes/<name>/HEAD is\ndeleted.\n\nWith -a or --auto, the remote is queried to determine its HEAD,\nthen the symbolic-ref refs/remotes/<name>/HEAD is set to the same\nbranch. e.g., if the remote HEAD is pointed at next, git remote\nset-head origin -a will set the symbolic-ref\nrefs/remotes/origin/HEAD to refs/remotes/origin/next. This will\nonly work if refs/remotes/origin/next already exists; if not it\nmust be fetched first.\n\nUse <branch> to set the symbolic-ref refs/remotes/<name>/HEAD\nexplicitly. e.g., git remote set-head origin master will set the\nsymbolic-ref refs/remotes/origin/HEAD to\nrefs/remotes/origin/master. This will only work if\nrefs/remotes/origin/master already exists; if not it must be\nfetched first.\n\nset-branches\nChanges the list of branches tracked by the named remote. This can\nbe used to track a subset of the available remote branches after\nthe initial setup for a remote.\n\nThe named branches will be interpreted as if specified with the -t\noption on the git remote add command line.\n\nWith --add, instead of replacing the list of currently tracked\nbranches, adds to that list.\n\nget-url\nRetrieves the URLs for a remote. Configurations for insteadOf and\npushInsteadOf are expanded here. By default, only the first URL is\nlisted.\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\nmatches regex <oldurl> (first URL if no <oldurl> is given) to\n<newurl>. If <oldurl> doesn't match any URL, an error occurs and\nnothing 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\nregex <url> are deleted for remote <name>. Trying to delete all\nnon-push URLs is an error.\n\nNote that the push URL and the fetch URL, even though they can be\nset differently, must still refer to the same place. What you\npushed to the push URL should be what you would see if you\nimmediately fetched from the fetch URL. If you are trying to fetch\nfrom one place (e.g. your upstream) and push to another (e.g. your\npublishing repository), use two separate remotes.\n\nshow\nGives some information about the remote <name>.\n\nWith -n option, the remote heads are not queried first with git\nls-remote <name>; cached information is used instead.\n\nprune\nDeletes stale references associated with <name>. By default, stale\nremote-tracking branches under <name> are deleted, but depending on\nglobal configuration and the configuration of the remote we might\neven prune local tags that haven't been pushed there. Equivalent to\ngit 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\ndepending on various configuration.\n\nWith --dry-run option, report what branches would be pruned, but do\nnot actually prune them.\n\nupdate\nFetch updates for remotes or remote groups in the repository as\ndefined by remotes.<group>. If neither group nor remote is\nspecified on the command line, the configuration parameter\nremotes.default will be used; if remotes.default is not defined,\nall remotes which do not have the configuration parameter\nremote.<name>.skipDefaultUpdate set to true will be updated. (See\ngit-config(1)).\n\nWith --prune option, run pruning against all the remotes that are\nupdated.\n",
                "subsections": []
            },
            "DISCUSSION": {
                "content": "The remote configuration is achieved using the remote.origin.url and\nremote.origin.fetch configuration 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\nin question, the exit status is 2. When the remote already exists, the\nexit status is 3.\n\nOn any other error, the exit status may be any other non-zero value.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "o   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\no   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",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "git-fetch(1) git-branch(1) git-config(1)\n",
                "subsections": []
            },
            "GIT": {
                "content": "Part of the git(1) suite\n\nGit 2.34.1                        02/26/2026                     GIT-REMOTE(1)",
                "subsections": []
            }
        }
    }
}