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] [--[no-]tags] [--mirror=<fetch|push>] <name> <url>
11       git remote rename <old> <new>
12       git remote remove <name>
13       git remote set-head <name> (-a | --auto | -d | --delete | <branch>)
14       git remote set-branches [--add] <name> <branch>...
15       git remote get-url [--push] [--all] <name>
16       git remote set-url [--push] <name> <newurl> [<oldurl>]
17       git remote set-url --add [--push] <name> <newurl>
18       git remote set-url --delete [--push] <name> <url>
19       git remote [-v | --verbose] show [-n] <name>...
20       git remote prune [-n | --dry-run] <name>...
21       git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
22
23

DESCRIPTION

25       Manage the set of repositories ("remotes") whose branches you track.
26

OPTIONS

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

COMMANDS

33       With no arguments, shows a list of existing remotes. Several
34       subcommands are available to perform operations on the remotes.
35
36       add
37           Adds a remote named <name> for the repository at <url>. The command
38           git fetch <name> can then be used to create and update
39           remote-tracking branches <name>/<branch>.
40
41           With -f option, git fetch <name> is run immediately after the
42           remote information is set up.
43
44           With --tags option, git fetch <name> imports every tag from the
45           remote repository.
46
47           With --no-tags option, git fetch <name> does not import tags from
48           the remote repository.
49
50           By default, only tags on fetched branches are imported (see git-
51           fetch(1)).
52
53           With -t <branch> option, instead of the default glob refspec for
54           the remote to track all branches under the refs/remotes/<name>/
55           namespace, a refspec to track only <branch> is created. You can
56           give more than one -t <branch> to track multiple branches without
57           grabbing all branches.
58
59           With -m <master> option, a symbolic-ref refs/remotes/<name>/HEAD is
60           set up to point at remote’s <master> branch. See also the set-head
61           command.
62
63           When a fetch mirror is created with --mirror=fetch, the refs will
64           not be stored in the refs/remotes/ namespace, but rather everything
65           in refs/ on the remote will be directly mirrored into refs/ in the
66           local repository. This option only makes sense in bare
67           repositories, because a fetch would overwrite any local commits.
68
69           When a push mirror is created with --mirror=push, then git push
70           will always behave as if --mirror was passed.
71
72       rename
73           Rename the remote named <old> to <new>. All remote-tracking
74           branches and configuration settings for the remote are updated.
75
76           In case <old> and <new> are the same, and <old> is a file under
77           $GIT_DIR/remotes or $GIT_DIR/branches, the remote is converted to
78           the configuration file format.
79
80       remove, rm
81           Remove the remote named <name>. All remote-tracking branches and
82           configuration settings for the remote are removed.
83
84       set-head
85           Sets or deletes the default branch (i.e. the target of the
86           symbolic-ref refs/remotes/<name>/HEAD) for the named remote. Having
87           a default branch for a remote is not required, but allows the name
88           of the remote to be specified in lieu of a specific branch. For
89           example, if the default branch for origin is set to master, then
90           origin may be specified wherever you would normally specify
91           origin/master.
92
93           With -d or --delete, the symbolic ref refs/remotes/<name>/HEAD is
94           deleted.
95
96           With -a or --auto, the remote is queried to determine its HEAD,
97           then the symbolic-ref refs/remotes/<name>/HEAD is set to the same
98           branch. e.g., if the remote HEAD is pointed at next, "git remote
99           set-head origin -a" will set the symbolic-ref
100           refs/remotes/origin/HEAD to refs/remotes/origin/next. This will
101           only work if refs/remotes/origin/next already exists; if not it
102           must be fetched first.
103
104           Use <branch> to set the symbolic-ref refs/remotes/<name>/HEAD
105           explicitly. e.g., "git remote set-head origin master" will set the
106           symbolic-ref refs/remotes/origin/HEAD to
107           refs/remotes/origin/master. This will only work if
108           refs/remotes/origin/master already exists; if not it must be
109           fetched first.
110
111       set-branches
112           Changes the list of branches tracked by the named remote. This can
113           be used to track a subset of the available remote branches after
114           the initial setup for a remote.
115
116           The named branches will be interpreted as if specified with the -t
117           option on the git remote add command line.
118
119           With --add, instead of replacing the list of currently tracked
120           branches, adds to that list.
121
122       get-url
123           Retrieves the URLs for a remote. Configurations for insteadOf and
124           pushInsteadOf are expanded here. By default, only the first URL is
125           listed.
126
127           With --push, push URLs are queried rather than fetch URLs.
128
129           With --all, all URLs for the remote will be listed.
130
131       set-url
132           Changes URLs for the remote. Sets first URL for remote <name> that
133           matches regex <oldurl> (first URL if no <oldurl> is given) to
134           <newurl>. If <oldurl> doesn’t match any URL, an error occurs and
135           nothing is changed.
136
137           With --push, push URLs are manipulated instead of fetch URLs.
138
139           With --add, instead of changing existing URLs, new URL is added.
140
141           With --delete, instead of changing existing URLs, all URLs matching
142           regex <url> are deleted for remote <name>. Trying to delete all
143           non-push URLs is an error.
144
145           Note that the push URL and the fetch URL, even though they can be
146           set differently, must still refer to the same place. What you
147           pushed to the push URL should be what you would see if you
148           immediately fetched from the fetch URL. If you are trying to fetch
149           from one place (e.g. your upstream) and push to another (e.g. your
150           publishing repository), use two separate remotes.
151
152       show
153           Gives some information about the remote <name>.
154
155           With -n option, the remote heads are not queried first with git
156           ls-remote <name>; cached information is used instead.
157
158       prune
159           Deletes stale references associated with <name>. By default, stale
160           remote-tracking branches under <name> are deleted, but depending on
161           global configuration and the configuration of the remote we might
162           even prune local tags that haven’t been pushed there. Equivalent to
163           git fetch --prune <name>, except that no new references will be
164           fetched.
165
166           See the PRUNING section of git-fetch(1) for what it’ll prune
167           depending on various configuration.
168
169           With --dry-run option, report what branches will be pruned, but do
170           not actually prune them.
171
172       update
173           Fetch updates for remotes or remote groups in the repository as
174           defined by remotes.<group>. If neither group nor remote is
175           specified on the command line, the configuration parameter
176           remotes.default will be used; if remotes.default is not defined,
177           all remotes which do not have the configuration parameter
178           remote.<name>.skipDefaultUpdate set to true will be updated. (See
179           git-config(1)).
180
181           With --prune option, run pruning against all the remotes that are
182           updated.
183

DISCUSSION

185       The remote configuration is achieved using the remote.origin.url and
186       remote.origin.fetch configuration variables. (See git-config(1)).
187

EXAMPLES

189       ·   Add a new remote, fetch, and check out a branch from it
190
191               $ git remote
192               origin
193               $ git branch -r
194                 origin/HEAD -> origin/master
195                 origin/master
196               $ git remote add staging git://git.kernel.org/.../gregkh/staging.git
197               $ git remote
198               origin
199               staging
200               $ git fetch staging
201               ...
202               From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
203                * [new branch]      master     -> staging/master
204                * [new branch]      staging-linus -> staging/staging-linus
205                * [new branch]      staging-next -> staging/staging-next
206               $ git branch -r
207                 origin/HEAD -> origin/master
208                 origin/master
209                 staging/master
210                 staging/staging-linus
211                 staging/staging-next
212               $ git checkout -b staging staging/master
213               ...
214
215
216       ·   Imitate git clone but track only selected branches
217
218               $ mkdir project.git
219               $ cd project.git
220               $ git init
221               $ git remote add -f -t master -m master origin git://example.com/git.git/
222               $ git merge origin
223
224

SEE ALSO

226       git-fetch(1) git-branch(1) git-config(1)
227

GIT

229       Part of the git(1) suite
230
231
232
233Git 2.18.1                        05/14/2019                     GIT-REMOTE(1)
Impressum