6 git-remote - Manage set of tracked repositories
12 'git remote' [-v | --verbose]
13 'git remote add' [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=<fetch|push>] <name> <url>
14 'git remote rename' <old> <new>
15 'git remote remove' <name>
16 'git remote set-head' <name> (-a | --auto | -d | --delete | <branch>)
17 'git remote set-branches' [--add] <name> <branch>...
18 'git remote get-url' [--push] [--all] <name>
19 'git remote set-url' [--push] <name> <newurl> [<oldurl>]
20 'git remote set-url --add' [--push] <name> <newurl>
21 'git remote set-url --delete' [--push] <name> <url>
22 'git remote' [-v | --verbose] 'show' [-n] <name>...
23 'git remote prune' [-n | --dry-run] <name>...
24 'git remote' [-v | --verbose] 'update' [-p | --prune] [(<group> | <remote>)...]
29 Manage the set of repositories ("remotes") whose branches you track.
37 Be a little more verbose and show remote url after name.
38 NOTE: This must be placed between `remote` and `subcommand`.
44 With no arguments, shows a list of existing remotes. Several
45 subcommands are available to perform operations on the remotes.
49 Adds a remote named <name> for the repository at
50 <url>. The command `git fetch <name>` can then be used to create and
51 update remote-tracking branches <name>/<branch>.
53 With `-f` option, `git fetch <name>` is run immediately after
54 the remote information is set up.
56 With `--tags` option, `git fetch <name>` imports every tag from the
59 With `--no-tags` option, `git fetch <name>` does not import tags from
60 the remote repository.
62 By default, only tags on fetched branches are imported
63 (see linkgit:git-fetch[1]).
65 With `-t <branch>` option, instead of the default glob
66 refspec for the remote to track all branches under
67 the `refs/remotes/<name>/` namespace, a refspec to track only `<branch>`
68 is created. You can give more than one `-t <branch>` to track
69 multiple branches without grabbing all branches.
71 With `-m <master>` option, a symbolic-ref `refs/remotes/<name>/HEAD` is set
72 up to point at remote's `<master>` branch. See also the set-head command.
74 When a fetch mirror is created with `--mirror=fetch`, the refs will not
75 be stored in the 'refs/remotes/' namespace, but rather everything in
76 'refs/' on the remote will be directly mirrored into 'refs/' in the
77 local repository. This option only makes sense in bare repositories,
78 because a fetch would overwrite any local commits.
80 When a push mirror is created with `--mirror=push`, then `git push`
81 will always behave as if `--mirror` was passed.
85 Rename the remote named <old> to <new>. All remote-tracking branches and
86 configuration settings for the remote are updated.
88 In case <old> and <new> are the same, and <old> is a file under
89 `$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to
90 the configuration file format.
95 Remove the remote named <name>. All remote-tracking branches and
96 configuration settings for the remote are removed.
100 Sets or deletes the default branch (i.e. the target of the
101 symbolic-ref `refs/remotes/<name>/HEAD`) for
102 the named remote. Having a default branch for a remote is not required,
103 but allows the name of the remote to be specified in lieu of a specific
104 branch. For example, if the default branch for `origin` is set to
105 `master`, then `origin` may be specified wherever you would normally
106 specify `origin/master`.
108 With `-d` or `--delete`, the symbolic ref `refs/remotes/<name>/HEAD` is deleted.
110 With `-a` or `--auto`, the remote is queried to determine its `HEAD`, then the
111 symbolic-ref `refs/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote
112 `HEAD` is pointed at `next`, "`git remote set-head origin -a`" will set
113 the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will
114 only work if `refs/remotes/origin/next` already exists; if not it must be
117 Use `<branch>` to set the symbolic-ref `refs/remotes/<name>/HEAD` explicitly. e.g., "git
118 remote set-head origin master" will set the symbolic-ref `refs/remotes/origin/HEAD` to
119 `refs/remotes/origin/master`. This will only work if
120 `refs/remotes/origin/master` already exists; if not it must be fetched first.
125 Changes the list of branches tracked by the named remote.
126 This can be used to track a subset of the available remote branches
127 after the initial setup for a remote.
129 The named branches will be interpreted as if specified with the
130 `-t` option on the 'git remote add' command line.
132 With `--add`, instead of replacing the list of currently tracked
133 branches, adds to that list.
137 Retrieves the URLs for a remote. Configurations for `insteadOf` and
138 `pushInsteadOf` are expanded here. By default, only the first URL is listed.
140 With '--push', push URLs are queried rather than fetch URLs.
142 With '--all', all URLs for the remote will be listed.
146 Changes URLs for the remote. Sets first URL for remote <name> that matches
147 regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
148 <oldurl> doesn't match any URL, an error occurs and nothing is changed.
150 With '--push', push URLs are manipulated instead of fetch URLs.
152 With '--add', instead of changing existing URLs, new URL is added.
154 With '--delete', instead of changing existing URLs, all URLs matching
155 regex <url> are deleted for remote <name>. Trying to delete all
156 non-push URLs is an error.
158 Note that the push URL and the fetch URL, even though they can
159 be set differently, must still refer to the same place. What you
160 pushed to the push URL should be what you would see if you
161 immediately fetched from the fetch URL. If you are trying to
162 fetch from one place (e.g. your upstream) and push to another (e.g.
163 your publishing repository), use two separate remotes.
168 Gives some information about the remote <name>.
170 With `-n` option, the remote heads are not queried first with
171 `git ls-remote <name>`; cached information is used instead.
175 Deletes all stale remote-tracking branches under <name>.
176 These stale branches have already been removed from the remote repository
177 referenced by <name>, but are still locally available in
180 With `--dry-run` option, report what branches will be pruned, but do not
185 Fetch updates for a named set of remotes in the repository as defined by
186 remotes.<group>. If a named group is not specified on the command line,
187 the configuration parameter remotes.default will be used; if
188 remotes.default is not defined, all remotes which do not have the
189 configuration parameter remote.<name>.skipDefaultUpdate set to true will
190 be updated. (See linkgit:git-config[1]).
192 With `--prune` option, prune all the remotes that are updated.
198 The remote configuration is achieved using the `remote.origin.url` and
199 `remote.origin.fetch` configuration variables. (See
200 linkgit:git-config[1]).
205 * Add a new remote, fetch, and check out a branch from it
211 origin/HEAD -> origin/master
213 $ git remote add staging git://git.kernel.org/.../gregkh/staging.git
219 From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
220 * [new branch] master -> staging/master
221 * [new branch] staging-linus -> staging/staging-linus
222 * [new branch] staging-next -> staging/staging-next
224 origin/HEAD -> origin/master
227 staging/staging-linus
229 $ git checkout -b staging staging/master
233 * Imitate 'git clone' but track only selected branches
239 $ git remote add -f -t master -m master origin git://example.com/git.git/
247 linkgit:git-branch[1]
248 linkgit:git-config[1]
252 Part of the linkgit:git[1] suite