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