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