Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/git-remote.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / git-remote.adoc` 274 lines ยท 9030 bytes Raw Blame History 1 git-remote(1) 2 ============= 3 4 NAME 5 ---- 6 git-remote - Manage set of tracked repositories 7 8 9 SYNOPSIS 10 -------- 11 [synopsis] 12 git remote [-v | --verbose] 13 git remote add [-t ] [-m ] [-f] [--[no-]tags] [--mirror=(fetch|push)] 14 git remote rename [--[no-]progress] 15 git remote remove 16 git remote set-head (-a | --auto | -d | --delete | ) 17 git remote set-branches [--add] ... 18 git remote get-url [--push] [--all] 19 git remote set-url [--push] [] 20 git remote set-url --add [--push] 21 git remote set-url --delete [--push] 22 git remote [-v | --verbose] show [-n] ... 23 git remote prune [-n | --dry-run] ... 24 git remote [-v | --verbose] update [-p | --prune] [( | )...] 25 26 DESCRIPTION 27 ----------- 28 29 Manage the set of repositories ("remotes") whose branches you track. 30 31 `git remote` changes only the local repository, i.e. its configuration 32 and its refs, and never modifies a remote repository. Some subcommands, 33 such as `show`, `prune`, `update` and `set-head --auto`, contact a 34 remote repository to read from it. 35 36 37 OPTIONS 38 ------- 39 40 `-v`:: 41 `--verbose`:: 42 Be a little more verbose and show remote url after name. 43 For promisor remotes, also show which filters (`blob:none` etc.) 44 are configured. 45 NOTE: This must be placed between `remote` and subcommand. 46 47 48 COMMANDS 49 -------- 50 51 With no arguments, show a list of existing remotes. Several 52 subcommands are available to perform operations on the remotes. 53 54 `add`:: 55 56 Add a remote named __ for the repository at 57 __. The command `git fetch ` can then be used to create and 58 update remote-tracking branches `/`. 59 + 60 With `-f` option, `git fetch ` is run immediately after 61 the remote information is set up. 62 + 63 With `--tags` option, `git fetch ` imports every tag from the 64 remote repository. 65 + 66 With `--no-tags` option, `git fetch ` does not import tags from 67 the remote repository. 68 + 69 By default, only tags on fetched branches are imported 70 (see linkgit:git-fetch[1]). 71 + 72 With `-t ` option, instead of the default glob 73 refspec for the remote to track all branches under 74 the `refs/remotes//` namespace, a refspec to track only __ 75 is created. You can give more than one `-t ` to track 76 multiple branches without grabbing all branches. 77 + 78 With `-m ` option, a symbolic-ref `refs/remotes//HEAD` is set 79 up to point at remote's __ branch. See also the set-head command. 80 + 81 When a fetch mirror is created with `--mirror=fetch`, the refs will not 82 be stored in the `refs/remotes/` namespace, but rather everything in 83 `refs/` on the remote will be directly mirrored into `refs/` in the 84 local repository. This option only makes sense in bare repositories, 85 because a fetch would overwrite any local commits. 86 + 87 When a push mirror is created with `--mirror=push`, then `git push` 88 will always behave as if `--mirror` was passed. 89 90 `rename`:: 91 92 Rename the remote named __ to __. All remote-tracking branches and 93 configuration settings for the remote are updated. 94 + 95 In case __ and __ are the same, and __ is a file under 96 `$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to 97 the configuration file format. 98 99 `remove`:: 100 `rm`:: 101 102 Remove the remote named __. All remote-tracking branches and 103 configuration settings for the remote are removed. 104 105 `set-head`:: 106 107 Set or delete the default branch (i.e. the target of the 108 symbolic-ref `refs/remotes//HEAD`) for 109 the named remote. Having a default branch for a remote is not required, 110 but allows the name of the remote to be specified in lieu of a specific 111 branch. For example, if the default branch for `origin` is set to 112 `master`, then `origin` may be specified wherever you would normally 113 specify `origin/master`. 114 + 115 With `-d` or `--delete`, the symbolic ref `refs/remotes//HEAD` is deleted. 116 + 117 With `-a` or `--auto`, the remote is queried to determine its `HEAD`, then the 118 symbolic-ref `refs/remotes//HEAD` is set to the same branch. e.g., if the remote 119 `HEAD` is pointed at `next`, `git remote set-head origin -a` will set 120 the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will 121 only work if `refs/remotes/origin/next` already exists; if not it must be 122 fetched first. 123 + 124 Use __ to set the symbolic-ref `refs/remotes//HEAD` explicitly. e.g., `git 125 remote set-head origin master` will set the symbolic-ref `refs/remotes/origin/HEAD` to 126 `refs/remotes/origin/master`. This will only work if 127 `refs/remotes/origin/master` already exists; if not it must be fetched first. 128 + 129 130 `set-branches`:: 131 132 Change the list of branches tracked by the named remote. 133 This can be used to track a subset of the available remote branches 134 after the initial setup for a remote. 135 + 136 The named branches will be interpreted as if specified with the 137 `-t` option on the `git remote add` command line. 138 + 139 With `--add`, instead of replacing the list of currently tracked 140 branches, adds to that list. 141 142 `get-url`:: 143 144 Retrieves the URLs for a remote. Configurations for `insteadOf` and 145 `pushInsteadOf` are expanded here. By default, only the first URL is listed. 146 + 147 With `--push`, push URLs are queried rather than fetch URLs. 148 + 149 With `--all`, all URLs for the remote will be listed. 150 151 `set-url`:: 152 153 Change URLs for the remote. Sets first URL for remote __ that matches 154 regex __ (first URL if no __ is given) to __. If 155 __ doesn't match any URL, an error occurs and nothing is changed. 156 + 157 With `--push`, push URLs are manipulated instead of fetch URLs. 158 + 159 With `--add`, instead of changing existing URLs, new URL is added. 160 + 161 With `--delete`, instead of changing existing URLs, all URLs matching 162 regex __ are deleted for remote __. Trying to delete all 163 non-push URLs is an error. 164 + 165 Note that the push URL and the fetch URL, even though they can 166 be set differently, must still refer to the same place. What you 167 pushed to the push URL should be what you would see if you 168 immediately fetched from the fetch URL. If you are trying to 169 fetch from one place (e.g. your upstream) and push to another (e.g. 170 your publishing repository), use two separate remotes. 171 172 173 `show`:: 174 175 Give some information about the remote __. 176 + 177 With `-n` option, the remote heads are not queried first with 178 `git ls-remote `; cached information is used instead. 179 180 `prune`:: 181 182 Delete stale references associated with __. By default, stale 183 remote-tracking branches under __ are deleted, but depending on 184 global configuration and the configuration of the remote we might even 185 prune local tags that haven't been pushed there. Equivalent to `git 186 fetch --prune `, except that no new references will be fetched. 187 + 188 See the PRUNING section of linkgit:git-fetch[1] for what it'll prune 189 depending on various configuration. 190 + 191 With `--dry-run` option, report what branches would be pruned, but do not 192 actually prune them. 193 194 `update`:: 195 196 Fetch updates for remotes or remote groups in the repository as defined by 197 `remotes.`. If neither group nor remote is specified on the command line, 198 the configuration parameter `remotes.default` will be used; if 199 `remotes.default` is not defined, all remotes which do not have the 200 configuration parameter `remote..skipDefaultUpdate` set to `true` will 201 be updated. (See linkgit:git-config[1]). 202 + 203 With `--prune` option, run pruning against all the remotes that are updated. 204 205 206 DISCUSSION 207 ---------- 208 209 The remote configuration is achieved using the `remote.origin.url` and 210 `remote.origin.fetch` configuration variables. (See 211 linkgit:git-config[1]). 212 213 EXIT STATUS 214 ----------- 215 216 On success, the exit status is `0`. 217 218 When subcommands such as `add`, `rename`, and `remove` can't find the 219 remote in question, the exit status is `2`. When the remote already 220 exists, the exit status is `3`. 221 222 On any other error, the exit status may be any other non-zero value. 223 224 EXAMPLES 225 -------- 226 227 * Add a new remote, fetch, and check out a branch from it 228 + 229 ------------ 230 $ git remote 231 origin 232 $ git branch -r 233 origin/HEAD -> origin/master 234 origin/master 235 $ git remote add staging git://git.kernel.org/.../gregkh/staging.git 236 $ git remote 237 origin 238 staging 239 $ git fetch staging 240 ... 241 From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging 242 * [new branch] master -> staging/master 243 * [new branch] staging-linus -> staging/staging-linus 244 * [new branch] staging-next -> staging/staging-next 245 $ git branch -r 246 origin/HEAD -> origin/master 247 origin/master 248 staging/master 249 staging/staging-linus 250 staging/staging-next 251 $ git switch -c staging staging/master 252 ... 253 ------------ 254 255 * Imitate `git clone` but track only selected branches 256 + 257 ------------ 258 $ mkdir project.git 259 $ cd project.git 260 $ git init 261 $ git remote add -f -t master -m master origin git://example.com/git.git/ 262 $ git merge origin 263 ------------ 264 265 266 SEE ALSO 267 -------- 268 linkgit:git-fetch[1] 269 linkgit:git-branch[1] 270 linkgit:git-config[1] 271 272 GIT 273 --- 274 Part of the linkgit:git[1] suite