1git-remote(1) 2============ 3 4NAME 5---- 6git-remote - manage set of tracked repositories 7 8 9SYNOPSIS 10-------- 11[verse] 12'git remote' [-v | --verbose] 13'git remote add' [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror] <name> <url> 14'git remote rename' <old> <new> 15'git remote rm' <name> 16'git remote set-head' <name> (-a | -d | <branch>) 17'git remote set-url' [--push] <name> <newurl> [<oldurl>] 18'git remote set-url --add' [--push] <name> <newurl> 19'git remote set-url --delete' [--push] <name> <url> 20'git remote' [-v | --verbose] 'show' [-n] <name> 21'git remote prune' [-n | --dry-run] <name> 22'git remote' [-v | --verbose] 'update' [-p | --prune] [group | remote]... 23 24DESCRIPTION 25----------- 26 27Manage the set of repositories ("remotes") whose branches you track. 28 29 30OPTIONS 31------- 32 33-v:: 34--verbose:: 35 Be a little more verbose and show remote url after name. 36 NOTE: This must be placed between `remote` and `subcommand`. 37 38 39COMMANDS 40-------- 41 42With no arguments, shows a list of existing remotes. Several 43subcommands are available to perform operations on the remotes. 44 45'add':: 46 47Adds a remote named <name> for the repository at 48<url>. The command `git fetch <name>` can then be used to create and 49update remote-tracking branches <name>/<branch>. 50+ 51With `-f` option, `git fetch <name>` is run immediately after 52the remote information is set up. 53+ 54With `--tags` option, `git fetch <name>` imports every tag from the 55remote repository. 56+ 57With `--no-tags` option, `git fetch <name>` does not import tags from 58the remote repository. 59+ 60With `-t <branch>` option, instead of the default glob 61refspec for the remote to track all branches under 62`$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>` 63is created. You can give more than one `-t <branch>` to track 64multiple branches without grabbing all branches. 65+ 66With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set 67up to point at remote's `<master>` branch. See also the set-head command. 68+ 69In mirror mode, enabled with `\--mirror`, the refs will not be stored 70in the 'refs/remotes/' namespace, but in 'refs/heads/'. This option 71only makes sense in bare repositories. If a remote uses mirror 72mode, furthermore, `git push` will always behave as if `\--mirror` 73was passed. 74 75'rename':: 76 77Rename the remote named <old> to <new>. All remote tracking branches and 78configuration settings for the remote are updated. 79+ 80In case <old> and <new> are the same, and <old> is a file under 81`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to 82the configuration file format. 83 84'rm':: 85 86Remove the remote named <name>. All remote tracking branches and 87configuration settings for the remote are removed. 88 89'set-head':: 90 91Sets or deletes the default branch (`$GIT_DIR/remotes/<name>/HEAD`) for 92the named remote. Having a default branch for a remote is not required, 93but allows the name of the remote to be specified in lieu of a specific 94branch. For example, if the default branch for `origin` is set to 95`master`, then `origin` may be specified wherever you would normally 96specify `origin/master`. 97+ 98With `-d`, `$GIT_DIR/remotes/<name>/HEAD` is deleted. 99+ 100With `-a`, the remote is queried to determine its `HEAD`, then 101`$GIT_DIR/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote 102`HEAD` is pointed at `next`, "`git remote set-head origin -a`" will set 103`$GIT_DIR/refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will 104only work if `refs/remotes/origin/next` already exists; if not it must be 105fetched first. 106+ 107Use `<branch>` to set `$GIT_DIR/remotes/<name>/HEAD` explicitly. e.g., "git 108remote set-head origin master" will set `$GIT_DIR/refs/remotes/origin/HEAD` to 109`refs/remotes/origin/master`. This will only work if 110`refs/remotes/origin/master` already exists; if not it must be fetched first. 111+ 112 113'set-url':: 114 115Changes URL remote points to. Sets first URL remote points to matching 116regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If 117<oldurl> doesn't match any URL, error occurs and nothing is changed. 118+ 119With '--push', push URLs are manipulated instead of fetch URLs. 120+ 121With '--add', instead of changing some URL, new URL is added. 122+ 123With '--delete', instead of changing some URL, all URLs matching 124regex <url> are deleted. Trying to delete all non-push URLs is an 125error. 126 127'show':: 128 129Gives some information about the remote <name>. 130+ 131With `-n` option, the remote heads are not queried first with 132`git ls-remote <name>`; cached information is used instead. 133 134'prune':: 135 136Deletes all stale tracking branches under <name>. 137These stale branches have already been removed from the remote repository 138referenced by <name>, but are still locally available in 139"remotes/<name>". 140+ 141With `--dry-run` option, report what branches will be pruned, but do not 142actually prune them. 143 144'update':: 145 146Fetch updates for a named set of remotes in the repository as defined by 147remotes.<group>. If a named group is not specified on the command line, 148the configuration parameter remotes.default will be used; if 149remotes.default is not defined, all remotes which do not have the 150configuration parameter remote.<name>.skipDefaultUpdate set to true will 151be updated. (See linkgit:git-config[1]). 152+ 153With `--prune` option, prune all the remotes that are updated. 154 155 156DISCUSSION 157---------- 158 159The remote configuration is achieved using the `remote.origin.url` and 160`remote.origin.fetch` configuration variables. (See 161linkgit:git-config[1]). 162 163Examples 164-------- 165 166* Add a new remote, fetch, and check out a branch from it 167+ 168------------ 169$ git remote 170origin 171$ git branch -r 172origin/master 173$ git remote add linux-nfs git://linux-nfs.org/pub/linux/nfs-2.6.git 174$ git remote 175linux-nfs 176origin 177$ git fetch 178* refs/remotes/linux-nfs/master: storing branch 'master' ... 179 commit: bf81b46 180$ git branch -r 181origin/master 182linux-nfs/master 183$ git checkout -b nfs linux-nfs/master 184... 185------------ 186 187* Imitate 'git clone' but track only selected branches 188+ 189------------ 190$ mkdir project.git 191$ cd project.git 192$ git init 193$ git remote add -f -t master -m master origin git://example.com/git.git/ 194$ git merge origin 195------------ 196 197 198SEE ALSO 199-------- 200linkgit:git-fetch[1] 201linkgit:git-branch[1] 202linkgit:git-config[1] 203 204Author 205------ 206Written by Junio Hamano 207 208 209Documentation 210-------------- 211Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>. 212 213 214GIT 215--- 216Part of the linkgit:git[1] suite