1GIT-REMOTE(1)                     Git Manual                     GIT-REMOTE(1)
2
3
4

NAME

6       git-remote - manage set of tracked repositories
7

SYNOPSIS

9       git remote [-v | --verbose]
10       git remote add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>
11       git remote rename <old> <new>
12       git remote rm <name>
13       git remote set-head <name> (-a | -d | <branch>)
14       git remote set-url [--push] <name> <newurl> [<oldurl>]
15       git remote set-url --add [--push] <name> <newurl>
16       git remote set-url --delete [--push] <name> <url>
17       git remote [-v | --verbose] show [-n] <name>
18       git remote prune [-n | --dry-run] <name>
19       git remote [-v | --verbose] update [-p | --prune] [group | remote]...
20
21

DESCRIPTION

23       Manage the set of repositories ("remotes") whose branches you track.
24

OPTIONS

26       -v, --verbose
27           Be a little more verbose and show remote url after name. NOTE: This
28           must be placed between remote and subcommand.
29

COMMANDS

31       With no arguments, shows a list of existing remotes. Several
32       subcommands are available to perform operations on the remotes.
33
34       add
35           Adds a remote named <name> for the repository at <url>. The command
36           git fetch <name> can then be used to create and update
37           remote-tracking branches <name>/<branch>.
38
39           With -f option, git fetch <name> is run immediately after the
40           remote information is set up.
41
42           With -t <branch> option, instead of the default glob refspec for
43           the remote to track all branches under $GIT_DIR/remotes/<name>/, a
44           refspec to track only <branch> is created. You can give more than
45           one -t <branch> to track multiple branches without grabbing all
46           branches.
47
48           With -m <master> option, $GIT_DIR/remotes/<name>/HEAD is set up to
49           point at remote’s <master> branch. See also the set-head command.
50
51           In mirror mode, enabled with --mirror, the refs will not be stored
52           in the refs/remotes/ namespace, but in refs/heads/. This option
53           only makes sense in bare repositories. If a remote uses mirror
54           mode, furthermore, git push will always behave as if --mirror was
55           passed.
56
57       rename
58           Rename the remote named <old> to <new>. All remote tracking
59           branches and configuration settings for the remote are updated.
60
61           In case <old> and <new> are the same, and <old> is a file under
62           $GIT_DIR/remotes or $GIT_DIR/branches, the remote is converted to
63           the configuration file format.
64
65       rm
66           Remove the remote named <name>. All remote tracking branches and
67           configuration settings for the remote are removed.
68
69       set-head
70           Sets or deletes the default branch ($GIT_DIR/remotes/<name>/HEAD)
71           for the named remote. Having a default branch for a remote is not
72           required, but allows the name of the remote to be specified in lieu
73           of a specific branch. For example, if the default branch for origin
74           is set to master, then origin may be specified wherever you would
75           normally specify origin/master.
76
77           With -d, $GIT_DIR/remotes/<name>/HEAD is deleted.
78
79           With -a, the remote is queried to determine its HEAD, then
80           $GIT_DIR/remotes/<name>/HEAD is set to the same branch. e.g., if
81           the remote HEAD is pointed at next, "git remote set-head origin -a"
82           will set $GIT_DIR/refs/remotes/origin/HEAD to
83           refs/remotes/origin/next. This will only work if
84           refs/remotes/origin/next already exists; if not it must be fetched
85           first.
86
87           Use <branch> to set $GIT_DIR/remotes/<name>/HEAD explicitly. e.g.,
88           "git remote set-head origin master" will set
89           $GIT_DIR/refs/remotes/origin/HEAD to refs/remotes/origin/master.
90           This will only work if refs/remotes/origin/master already exists;
91           if not it must be fetched first.
92
93       set-url
94           Changes URL remote points to. Sets first URL remote points to
95           matching regex <oldurl> (first URL if no <oldurl> is given) to
96           <newurl>. If <oldurl> doesn’t match any URL, error occurs and
97           nothing is changed.
98
99           With --push, push URLs are manipulated instead of fetch URLs.
100
101           With --add, instead of changing some URL, new URL is added.
102
103           With --delete, instead of changing some URL, all URLs matching
104           regex <url> are deleted. Trying to delete all non-push URLs is an
105           error.
106
107       show
108           Gives some information about the remote <name>.
109
110           With -n option, the remote heads are not queried first with git
111           ls-remote <name>; cached information is used instead.
112
113       prune
114           Deletes all stale tracking branches under <name>. These stale
115           branches have already been removed from the remote repository
116           referenced by <name>, but are still locally available in
117           "remotes/<name>".
118
119           With --dry-run option, report what branches will be pruned, but do
120           not actually prune them.
121
122       update
123           Fetch updates for a named set of remotes in the repository as
124           defined by remotes.<group>. If a named group is not specified on
125           the command line, the configuration parameter remotes.default will
126           be used; if remotes.default is not defined, all remotes which do
127           not have the configuration parameter
128           remote.<name>.skipDefaultUpdate set to true will be updated. (See
129           git-config(1)).
130
131           With --prune option, prune all the remotes that are updated.
132

DISCUSSION

134       The remote configuration is achieved using the remote.origin.url and
135       remote.origin.fetch configuration variables. (See git-config(1)).
136

EXAMPLES

138       ·   Add a new remote, fetch, and check out a branch from it
139
140               $ git remote
141               origin
142               $ git branch -r
143               origin/master
144               $ git remote add linux-nfs git://linux-nfs.org/pub/linux/nfs-2.6.git
145               $ git remote
146               linux-nfs
147               origin
148               $ git fetch
149               * refs/remotes/linux-nfs/master: storing branch ´master´ ...
150                 commit: bf81b46
151               $ git branch -r
152               origin/master
153               linux-nfs/master
154               $ git checkout -b nfs linux-nfs/master
155               ...
156
157
158       ·   Imitate git clone but track only selected branches
159
160               $ mkdir project.git
161               $ cd project.git
162               $ git init
163               $ git remote add -f -t master -m master origin git://example.com/git.git/
164               $ git merge origin
165
166

SEE ALSO

168       git-fetch(1) git-branch(1) git-config(1)
169

AUTHOR

171       Written by Junio Hamano
172

DOCUMENTATION

174       Documentation by J. Bruce Fields and the git-list
175       <git@vger.kernel.org[1]>.
176

GIT

178       Part of the git(1) suite
179

NOTES

181        1. git@vger.kernel.org
182           mailto:git@vger.kernel.org
183
184
185
186Git 1.7.1                         08/16/2017                     GIT-REMOTE(1)
Impressum