Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 7.0.2" /> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | <style type="text/css"> |
| 8 | /* Debug borders */ |
| 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 10 | /* |
| 11 | border: 1px solid red; |
| 12 | */ |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | margin: 1em 5% 1em 5%; |
| 17 | } |
| 18 | |
| 19 | a { color: blue; } |
| 20 | a:visited { color: fuchsia; } |
| 21 | |
| 22 | em { |
| 23 | font-style: italic; |
| 24 | } |
| 25 | |
| 26 | strong { |
| 27 | font-weight: bold; |
| 28 | } |
| 29 | |
| 30 | tt { |
| 31 | color: navy; |
| 32 | } |
| 33 | |
| 34 | h1, h2, h3, h4, h5, h6 { |
| 35 | color: #527bbd; |
| 36 | font-family: sans-serif; |
| 37 | margin-top: 1.2em; |
| 38 | margin-bottom: 0.5em; |
| 39 | line-height: 1.3; |
| 40 | } |
| 41 | |
| 42 | h1 { |
| 43 | border-bottom: 2px solid silver; |
| 44 | } |
| 45 | h2 { |
| 46 | border-bottom: 2px solid silver; |
| 47 | padding-top: 0.5em; |
| 48 | } |
| 49 | |
| 50 | div.sectionbody { |
| 51 | font-family: serif; |
| 52 | margin-left: 0; |
| 53 | } |
| 54 | |
| 55 | hr { |
| 56 | border: 1px solid silver; |
| 57 | } |
| 58 | |
| 59 | p { |
| 60 | margin-top: 0.5em; |
| 61 | margin-bottom: 0.5em; |
| 62 | } |
| 63 | |
| 64 | pre { |
| 65 | padding: 0; |
| 66 | margin: 0; |
| 67 | } |
| 68 | |
| 69 | span#author { |
| 70 | color: #527bbd; |
| 71 | font-family: sans-serif; |
| 72 | font-weight: bold; |
| 73 | font-size: 1.2em; |
| 74 | } |
| 75 | span#email { |
| 76 | } |
| 77 | span#revision { |
| 78 | font-family: sans-serif; |
| 79 | } |
| 80 | |
| 81 | div#footer { |
| 82 | font-family: sans-serif; |
| 83 | font-size: small; |
| 84 | border-top: 2px solid silver; |
| 85 | padding-top: 0.5em; |
| 86 | margin-top: 4.0em; |
| 87 | } |
| 88 | div#footer-text { |
| 89 | float: left; |
| 90 | padding-bottom: 0.5em; |
| 91 | } |
| 92 | div#footer-badges { |
| 93 | float: right; |
| 94 | padding-bottom: 0.5em; |
| 95 | } |
| 96 | |
| 97 | div#preamble, |
| 98 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 99 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 100 | div.admonitionblock { |
| 101 | margin-right: 10%; |
| 102 | margin-top: 1.5em; |
| 103 | margin-bottom: 1.5em; |
| 104 | } |
| 105 | div.admonitionblock { |
| 106 | margin-top: 2.5em; |
| 107 | margin-bottom: 2.5em; |
| 108 | } |
| 109 | |
| 110 | div.content { /* Block element content. */ |
| 111 | padding: 0; |
| 112 | } |
| 113 | |
| 114 | /* Block element titles. */ |
| 115 | div.title, caption.title { |
| 116 | font-family: sans-serif; |
| 117 | font-weight: bold; |
| 118 | text-align: left; |
| 119 | margin-top: 1.0em; |
| 120 | margin-bottom: 0.5em; |
| 121 | } |
| 122 | div.title + * { |
| 123 | margin-top: 0; |
| 124 | } |
| 125 | |
| 126 | td div.title:first-child { |
| 127 | margin-top: 0.0em; |
| 128 | } |
| 129 | div.content div.title:first-child { |
| 130 | margin-top: 0.0em; |
| 131 | } |
| 132 | div.content + div.title { |
| 133 | margin-top: 0.0em; |
| 134 | } |
| 135 | |
| 136 | div.sidebarblock > div.content { |
| 137 | background: #ffffee; |
| 138 | border: 1px solid silver; |
| 139 | padding: 0.5em; |
| 140 | } |
| 141 | |
| 142 | div.listingblock > div.content { |
| 143 | border: 1px solid silver; |
| 144 | background: #f4f4f4; |
| 145 | padding: 0.5em; |
| 146 | } |
| 147 | |
| 148 | div.quoteblock > div.content { |
| 149 | padding-left: 2.0em; |
| 150 | } |
| 151 | div.quoteblock .attribution { |
| 152 | text-align: right; |
| 153 | } |
| 154 | |
| 155 | div.admonitionblock .icon { |
| 156 | vertical-align: top; |
| 157 | font-size: 1.1em; |
| 158 | font-weight: bold; |
| 159 | text-decoration: underline; |
| 160 | color: #527bbd; |
| 161 | padding-right: 0.5em; |
| 162 | } |
| 163 | div.admonitionblock td.content { |
| 164 | padding-left: 0.5em; |
| 165 | border-left: 2px solid silver; |
| 166 | } |
| 167 | |
| 168 | div.exampleblock > div.content { |
| 169 | border-left: 2px solid silver; |
| 170 | padding: 0.5em; |
| 171 | } |
| 172 | |
| 173 | div.verseblock div.content { |
| 174 | white-space: pre; |
| 175 | } |
| 176 | |
| 177 | div.imageblock div.content { padding-left: 0; } |
| 178 | div.imageblock img { border: 1px solid silver; } |
| 179 | span.image img { border-style: none; } |
| 180 | |
| 181 | dl { |
| 182 | margin-top: 0.8em; |
| 183 | margin-bottom: 0.8em; |
| 184 | } |
| 185 | dt { |
| 186 | margin-top: 0.5em; |
| 187 | margin-bottom: 0; |
| 188 | font-style: italic; |
| 189 | } |
| 190 | dd > *:first-child { |
| 191 | margin-top: 0; |
| 192 | } |
| 193 | |
| 194 | ul, ol { |
| 195 | list-style-position: outside; |
| 196 | } |
| 197 | ol.olist2 { |
| 198 | list-style-type: lower-alpha; |
| 199 | } |
| 200 | |
| 201 | div.tableblock > table { |
| 202 | border-color: #527bbd; |
| 203 | border-width: 3px; |
| 204 | } |
| 205 | thead { |
| 206 | font-family: sans-serif; |
| 207 | font-weight: bold; |
| 208 | } |
| 209 | tfoot { |
| 210 | font-weight: bold; |
| 211 | } |
| 212 | |
| 213 | div.hlist { |
| 214 | margin-top: 0.8em; |
| 215 | margin-bottom: 0.8em; |
| 216 | } |
| 217 | td.hlist1 { |
| 218 | vertical-align: top; |
| 219 | font-style: italic; |
| 220 | padding-right: 0.8em; |
| 221 | } |
| 222 | td.hlist2 { |
| 223 | vertical-align: top; |
| 224 | } |
| 225 | |
| 226 | @media print { |
| 227 | div#footer-badges { display: none; } |
| 228 | } |
| 229 | include::./stylesheets/xhtml11-manpage.css[] |
| 230 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 231 | |
| 232 | div.sidebar-content { |
| 233 | background: #ffffee; |
| 234 | border: 1px solid silver; |
| 235 | padding: 0.5em; |
| 236 | } |
| 237 | div.sidebar-title, div.image-title { |
| 238 | font-family: sans-serif; |
| 239 | font-weight: bold; |
| 240 | margin-top: 0.0em; |
| 241 | margin-bottom: 0.5em; |
| 242 | } |
| 243 | |
| 244 | div.listingblock div.content { |
| 245 | border: 1px solid silver; |
| 246 | background: #f4f4f4; |
| 247 | padding: 0.5em; |
| 248 | } |
| 249 | |
| 250 | div.quoteblock-content { |
| 251 | padding-left: 2.0em; |
| 252 | } |
| 253 | |
| 254 | div.exampleblock-content { |
| 255 | border-left: 2px solid silver; |
| 256 | padding-left: 0.5em; |
| 257 | } |
| 258 | </style> |
| 259 | <title>git-clone(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-clone(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-clone - |
Junio C Hamano | 4ec0671 | 2007-06-09 20:39:33 | [diff] [blame] | 269 | Clone a repository into a new directory |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 275 | <div class="verseblock"> |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 276 | <div class="content"><em>git-clone</em> [--template=<template_directory>] |
| 277 | [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] |
Junio C Hamano | f31d9f5 | 2006-05-28 20:58:09 | [diff] [blame] | 278 | [-o <name>] [-u <upload-pack>] [--reference <repository>] |
Junio C Hamano | d814b6d | 2007-11-04 11:13:49 | [diff] [blame] | 279 | [--depth <depth>] [--] <repository> [<directory>]</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 280 | </div> |
| 281 | <h2>DESCRIPTION</h2> |
| 282 | <div class="sectionbody"> |
Junio C Hamano | 5102d9a | 2006-12-08 07:23:46 | [diff] [blame] | 283 | <p>Clones a repository into a newly created directory, creates |
| 284 | remote-tracking branches for each branch in the cloned repository |
Junio C Hamano | 79770b6 | 2007-01-07 07:43:58 | [diff] [blame] | 285 | (visible using <tt>git branch -r</tt>), and creates and checks out an initial |
| 286 | branch equal to the cloned repository's currently active branch.</p> |
Junio C Hamano | 5102d9a | 2006-12-08 07:23:46 | [diff] [blame] | 287 | <p>After the clone, a plain <tt>git fetch</tt> without arguments will update |
| 288 | all the remote-tracking branches, and a <tt>git pull</tt> without |
| 289 | arguments will in addition merge the remote master branch into the |
Junio C Hamano | 79770b6 | 2007-01-07 07:43:58 | [diff] [blame] | 290 | current master branch, if any.</p> |
Junio C Hamano | 5102d9a | 2006-12-08 07:23:46 | [diff] [blame] | 291 | <p>This default configuration is achieved by creating references to |
| 292 | the remote branch heads under <tt>$GIT_DIR/refs/remotes/origin</tt> and |
| 293 | by initializing <tt>remote.origin.url</tt> and <tt>remote.origin.fetch</tt> |
| 294 | configuration variables.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 295 | </div> |
| 296 | <h2>OPTIONS</h2> |
| 297 | <div class="sectionbody"> |
| 298 | <dl> |
| 299 | <dt> |
| 300 | --local |
| 301 | </dt> |
| 302 | <dt> |
| 303 | -l |
| 304 | </dt> |
| 305 | <dd> |
| 306 | <p> |
| 307 | When the repository to clone from is on a local machine, |
| 308 | this flag bypasses normal "git aware" transport |
| 309 | mechanism and clones the repository by making a copy of |
| 310 | HEAD and everything under objects and refs directories. |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 311 | The files under <tt>.git/objects/</tt> directory are hardlinked |
| 312 | to save space when possible. This is now the default when |
| 313 | the source repository is specified with <tt>/path/to/repo</tt> |
| 314 | syntax, so it essentially is a no-op option. To force |
| 315 | copying instead of hardlinking (which may be desirable |
| 316 | if you are trying to make a back-up of your repository), |
| 317 | but still avoid the usual "git aware" transport |
| 318 | mechanism, <tt>--no-hardlinks</tt> can be used. |
| 319 | </p> |
| 320 | </dd> |
| 321 | <dt> |
| 322 | --no-hardlinks |
| 323 | </dt> |
| 324 | <dd> |
| 325 | <p> |
| 326 | Optimize the cloning process from a repository on a |
| 327 | local filesystem by copying files under <tt>.git/objects</tt> |
| 328 | directory. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 329 | </p> |
| 330 | </dd> |
| 331 | <dt> |
| 332 | --shared |
| 333 | </dt> |
| 334 | <dt> |
| 335 | -s |
| 336 | </dt> |
| 337 | <dd> |
| 338 | <p> |
| 339 | When the repository to clone is on the local machine, |
| 340 | instead of using hard links, automatically setup |
Junio C Hamano | f50bfec | 2006-04-19 09:44:12 | [diff] [blame] | 341 | .git/objects/info/alternates to share the objects |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 342 | with the source repository. The resulting repository |
| 343 | starts out without any object of its own. |
| 344 | </p> |
Junio C Hamano | efe3c63 | 2008-02-14 00:51:31 | [diff] [blame] | 345 | <p><strong>NOTE</strong>: this is a possibly dangerous operation; do <strong>not</strong> use |
| 346 | it unless you understand what it does. If you clone your |
| 347 | repository using this option, then delete branches in the |
| 348 | source repository and then run <a href="git-gc.html">git-gc(1)</a> using the |
| 349 | <em>--prune</em> option in the source repository, it may remove |
| 350 | objects which are referenced by the cloned repository.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 351 | </dd> |
| 352 | <dt> |
Junio C Hamano | f50bfec | 2006-04-19 09:44:12 | [diff] [blame] | 353 | --reference <repository> |
| 354 | </dt> |
| 355 | <dd> |
| 356 | <p> |
| 357 | If the reference repository is on the local machine |
| 358 | automatically setup .git/objects/info/alternates to |
| 359 | obtain objects from the reference repository. Using |
| 360 | an already existing repository as an alternate will |
Junio C Hamano | 250f03e | 2007-09-10 01:33:28 | [diff] [blame] | 361 | require fewer objects to be copied from the repository |
Junio C Hamano | f50bfec | 2006-04-19 09:44:12 | [diff] [blame] | 362 | being cloned, reducing network and local storage costs. |
| 363 | </p> |
| 364 | </dd> |
| 365 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 366 | --quiet |
| 367 | </dt> |
| 368 | <dt> |
| 369 | -q |
| 370 | </dt> |
| 371 | <dd> |
| 372 | <p> |
| 373 | Operate quietly. This flag is passed to "rsync" and |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 374 | "git-fetch-pack" commands when given. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 375 | </p> |
| 376 | </dd> |
| 377 | <dt> |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 378 | --no-checkout |
| 379 | </dt> |
| 380 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 381 | -n |
| 382 | </dt> |
| 383 | <dd> |
| 384 | <p> |
| 385 | No checkout of HEAD is performed after the clone is complete. |
| 386 | </p> |
| 387 | </dd> |
| 388 | <dt> |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 389 | --bare |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 390 | </dt> |
| 391 | <dd> |
| 392 | <p> |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 393 | Make a <em>bare</em> GIT repository. That is, instead of |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 394 | creating <tt><directory></tt> and placing the administrative |
| 395 | files in <tt><directory>/.git</tt>, make the <tt><directory></tt> |
Junio C Hamano | 9f292e7 | 2006-11-24 11:37:29 | [diff] [blame] | 396 | itself the <tt>$GIT_DIR</tt>. This obviously implies the <tt>-n</tt> |
| 397 | because there is nowhere to check out the working tree. |
| 398 | Also the branch heads at the remote are copied directly |
| 399 | to corresponding local branch heads, without mapping |
| 400 | them to <tt>refs/remotes/origin/</tt>. When this option is |
Junio C Hamano | d3361ad | 2007-01-01 03:20:24 | [diff] [blame] | 401 | used, neither remote-tracking branches nor the related |
| 402 | configuration variables are created. |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 403 | </p> |
| 404 | </dd> |
| 405 | <dt> |
Junio C Hamano | dcc22ee | 2006-11-03 02:40:13 | [diff] [blame] | 406 | --origin <name> |
| 407 | </dt> |
| 408 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 409 | -o <name> |
| 410 | </dt> |
| 411 | <dd> |
| 412 | <p> |
Junio C Hamano | d3361ad | 2007-01-01 03:20:24 | [diff] [blame] | 413 | Instead of using the remote name <em>origin</em> to keep track |
| 414 | of the upstream repository, use <name> instead. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 415 | </p> |
| 416 | </dd> |
| 417 | <dt> |
| 418 | --upload-pack <upload-pack> |
| 419 | </dt> |
| 420 | <dt> |
| 421 | -u <upload-pack> |
| 422 | </dt> |
| 423 | <dd> |
| 424 | <p> |
| 425 | When given, and the repository to clone from is handled |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 426 | by <em>git-fetch-pack</em>, <em>--exec=<upload-pack></em> is passed to |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 427 | the command to specify non-default path for the command |
| 428 | run on the other end. |
| 429 | </p> |
| 430 | </dd> |
| 431 | <dt> |
Junio C Hamano | f31d9f5 | 2006-05-28 20:58:09 | [diff] [blame] | 432 | --template=<template_directory> |
| 433 | </dt> |
| 434 | <dd> |
| 435 | <p> |
| 436 | Specify the directory from which templates will be used; |
| 437 | if unset the templates are taken from the installation |
| 438 | defined default, typically <tt>/usr/share/git-core/templates</tt>. |
| 439 | </p> |
| 440 | </dd> |
| 441 | <dt> |
Junio C Hamano | 0bbd467 | 2007-02-20 04:52:14 | [diff] [blame] | 442 | --depth <depth> |
Junio C Hamano | b288d9e | 2007-01-02 00:04:15 | [diff] [blame] | 443 | </dt> |
| 444 | <dd> |
| 445 | <p> |
| 446 | Create a <em>shallow</em> clone with a history truncated to the |
Junio C Hamano | 1c70883 | 2007-11-02 02:47:50 | [diff] [blame] | 447 | specified number of revisions. A shallow repository has a |
Junio C Hamano | b288d9e | 2007-01-02 00:04:15 | [diff] [blame] | 448 | number of limitations (you cannot clone or fetch from |
| 449 | it, nor push from nor into it), but is adequate if you |
Junio C Hamano | 1c70883 | 2007-11-02 02:47:50 | [diff] [blame] | 450 | are only interested in the recent history of a large project |
| 451 | with a long history, and would want to send in fixes |
Junio C Hamano | b288d9e | 2007-01-02 00:04:15 | [diff] [blame] | 452 | as patches. |
| 453 | </p> |
| 454 | </dd> |
| 455 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 456 | <repository> |
| 457 | </dt> |
| 458 | <dd> |
| 459 | <p> |
Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 460 | The (possibly remote) repository to clone from. See the |
| 461 | <a href="#URLS">URLS</a> section below for more information on specifying |
| 462 | repositories. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 463 | </p> |
| 464 | </dd> |
| 465 | <dt> |
| 466 | <directory> |
| 467 | </dt> |
| 468 | <dd> |
| 469 | <p> |
| 470 | The name of a new directory to clone into. The "humanish" |
| 471 | part of the source repository is used if no directory is |
| 472 | explicitly given ("repo" for "/path/to/repo.git" and "foo" |
| 473 | for "host.xz:foo/.git"). Cloning into an existing directory |
| 474 | is not allowed. |
| 475 | </p> |
| 476 | </dd> |
| 477 | </dl> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 478 | </div> |
Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 479 | <h2>GIT URLS<a id="URLS"></a></h2> |
| 480 | <div class="sectionbody"> |
| 481 | <p>One of the following notations can be used |
| 482 | to name the remote repository:</p> |
| 483 | <div class="exampleblock"> |
| 484 | <div class="exampleblock-content"> |
| 485 | <ul> |
| 486 | <li> |
| 487 | <p> |
| 488 | rsync://host.xz/path/to/repo.git/ |
| 489 | </p> |
| 490 | </li> |
| 491 | <li> |
| 492 | <p> |
| 493 | http://host.xz/path/to/repo.git/ |
| 494 | </p> |
| 495 | </li> |
| 496 | <li> |
| 497 | <p> |
| 498 | https://host.xz/path/to/repo.git/ |
| 499 | </p> |
| 500 | </li> |
| 501 | <li> |
| 502 | <p> |
| 503 | git://host.xz/path/to/repo.git/ |
| 504 | </p> |
| 505 | </li> |
| 506 | <li> |
| 507 | <p> |
| 508 | git://host.xz/~user/path/to/repo.git/ |
| 509 | </p> |
| 510 | </li> |
| 511 | <li> |
| 512 | <p> |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 513 | ssh://[user@]host.xz[:port]/path/to/repo.git/ |
| 514 | </p> |
| 515 | </li> |
| 516 | <li> |
| 517 | <p> |
Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 518 | ssh://[user@]host.xz/path/to/repo.git/ |
| 519 | </p> |
| 520 | </li> |
| 521 | <li> |
| 522 | <p> |
| 523 | ssh://[user@]host.xz/~user/path/to/repo.git/ |
| 524 | </p> |
| 525 | </li> |
| 526 | <li> |
| 527 | <p> |
| 528 | ssh://[user@]host.xz/~/path/to/repo.git |
| 529 | </p> |
| 530 | </li> |
| 531 | </ul> |
| 532 | </div></div> |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 533 | <p>SSH is the default transport protocol over the network. You can |
| 534 | optionally specify which user to log-in as, and an alternate, |
| 535 | scp-like syntax is also supported. Both syntaxes support |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 536 | username expansion, as does the native git protocol, but |
| 537 | only the former supports port specification. The following |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 538 | three are identical to the last three above, respectively:</p> |
Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 539 | <div class="exampleblock"> |
| 540 | <div class="exampleblock-content"> |
| 541 | <ul> |
| 542 | <li> |
| 543 | <p> |
| 544 | [user@]host.xz:/path/to/repo.git/ |
| 545 | </p> |
| 546 | </li> |
| 547 | <li> |
| 548 | <p> |
| 549 | [user@]host.xz:~user/path/to/repo.git/ |
| 550 | </p> |
| 551 | </li> |
| 552 | <li> |
| 553 | <p> |
| 554 | [user@]host.xz:path/to/repo.git |
| 555 | </p> |
| 556 | </li> |
| 557 | </ul> |
| 558 | </div></div> |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 559 | <p>To sync with a local directory, you can use:</p> |
Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 560 | <div class="exampleblock"> |
| 561 | <div class="exampleblock-content"> |
| 562 | <ul> |
| 563 | <li> |
| 564 | <p> |
| 565 | /path/to/repo.git/ |
| 566 | </p> |
| 567 | </li> |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 568 | <li> |
| 569 | <p> |
| 570 | file:///path/to/repo.git/ |
| 571 | </p> |
| 572 | </li> |
Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 573 | </ul> |
| 574 | </div></div> |
Junio C Hamano | 63777e2 | 2007-11-17 20:52:16 | [diff] [blame] | 575 | <p>They are equivalent, except the former implies --local option.</p> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 576 | <p>If there are a large number of similarly-named remote repositories and |
| 577 | you want to use a different format for them (such that the URLs you |
| 578 | use will be rewritten into URLs that work), you can create a |
| 579 | configuration section of the form:</p> |
| 580 | <div class="listingblock"> |
| 581 | <div class="content"> |
| 582 | <pre><tt> [url "<actual url base>"] |
| 583 | insteadOf = <other url base></tt></pre> |
| 584 | </div></div> |
| 585 | <p>For example, with this:</p> |
| 586 | <div class="listingblock"> |
| 587 | <div class="content"> |
| 588 | <pre><tt> [url "git://git.host.xz/"] |
| 589 | insteadOf = host.xz:/path/to/ |
| 590 | insteadOf = work:</tt></pre> |
| 591 | </div></div> |
| 592 | <p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be |
| 593 | rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p> |
Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 594 | </div> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 595 | <h2>Examples</h2> |
| 596 | <div class="sectionbody"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 597 | <dl> |
| 598 | <dt> |
| 599 | Clone from upstream |
| 600 | </dt> |
| 601 | <dd> |
| 602 | <div class="listingblock"> |
| 603 | <div class="content"> |
| 604 | <pre><tt>$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6 |
| 605 | $ cd my2.6 |
| 606 | $ make</tt></pre> |
| 607 | </div></div> |
| 608 | </dd> |
| 609 | <dt> |
| 610 | Make a local clone that borrows from the current directory, without checking things out |
| 611 | </dt> |
| 612 | <dd> |
| 613 | <div class="listingblock"> |
| 614 | <div class="content"> |
| 615 | <pre><tt>$ git clone -l -s -n . ../copy |
Junio C Hamano | 8638c92 | 2007-05-12 20:50:08 | [diff] [blame] | 616 | $ cd ../copy |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 617 | $ git show-branch</tt></pre> |
| 618 | </div></div> |
| 619 | </dd> |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 620 | <dt> |
Junio C Hamano | f50bfec | 2006-04-19 09:44:12 | [diff] [blame] | 621 | Clone from upstream while borrowing from an existing local directory |
| 622 | </dt> |
| 623 | <dd> |
| 624 | <div class="listingblock"> |
| 625 | <div class="content"> |
| 626 | <pre><tt>$ git clone --reference my2.6 \ |
| 627 | git://git.kernel.org/pub/scm/.../linux-2.7 \ |
| 628 | my2.7 |
| 629 | $ cd my2.7</tt></pre> |
| 630 | </div></div> |
| 631 | </dd> |
| 632 | <dt> |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 633 | Create a bare repository to publish your changes to the public |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 634 | </dt> |
| 635 | <dd> |
| 636 | <div class="listingblock"> |
| 637 | <div class="content"> |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 638 | <pre><tt>$ git clone --bare -l /home/proj/.git /pub/scm/proj.git</tt></pre> |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 639 | </div></div> |
| 640 | </dd> |
| 641 | <dt> |
| 642 | Create a repository on the kernel.org machine that borrows from Linus |
| 643 | </dt> |
| 644 | <dd> |
| 645 | <div class="listingblock"> |
| 646 | <div class="content"> |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 647 | <pre><tt>$ git clone --bare -l -s /pub/scm/.../torvalds/linux-2.6.git \ |
Junio C Hamano | 38064d5 | 2006-01-15 10:13:49 | [diff] [blame] | 648 | /pub/scm/.../me/subsys-2.6.git</tt></pre> |
| 649 | </div></div> |
| 650 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 651 | </dl> |
| 652 | </div> |
| 653 | <h2>Author</h2> |
| 654 | <div class="sectionbody"> |
| 655 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 656 | </div> |
| 657 | <h2>Documentation</h2> |
| 658 | <div class="sectionbody"> |
| 659 | <p>Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 660 | </div> |
| 661 | <h2>GIT</h2> |
| 662 | <div class="sectionbody"> |
| 663 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 664 | </div> |
| 665 | <div id="footer"> |
| 666 | <div id="footer-text"> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 667 | Last updated 28-Feb-2008 00:25:37 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 668 | </div> |
| 669 | </div> |
| 670 | </body> |
| 671 | </html> |