logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

git-clone.1 (26993B)


  1. '\" t
  2. .\" Title: git-clone
  3. .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
  5. .\" Date: 2025-03-14
  6. .\" Manual: Git Manual
  7. .\" Source: Git 2.49.0
  8. .\" Language: English
  9. .\"
  10. .TH "GIT\-CLONE" "1" "2025-03-14" "Git 2\&.49\&.0" "Git Manual"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. git-clone \- Clone a repository into a new directory
  32. .SH "SYNOPSIS"
  33. .sp
  34. .nf
  35. \fBgit\fR \fBclone\fR [\fB\-\-template=\fR\fI<template\-directory>\fR]
  36. [\fB\-l\fR] [\fB\-s\fR] [\fB\-\-no\-hardlinks\fR] [\fB\-q\fR] [\fB\-n\fR] [\fB\-\-bare\fR] [\fB\-\-mirror\fR]
  37. [\fB\-o\fR \fI<name>\fR] [\fB\-b\fR \fI<name>\fR] [\fB\-u\fR \fI<upload\-pack>\fR] [\fB\-\-reference\fR \fI<repository>\fR]
  38. [\fB\-\-dissociate\fR] [\fB\-\-separate\-git\-dir\fR \fI<git\-dir>\fR]
  39. [\fB\-\-depth\fR \fI<depth>\fR] [\fB\-\-\fR[\fBno\-\fR]\fBsingle\-branch\fR] [\fB\-\-\fR[\fBno\-\fR]\fBtags\fR]
  40. [\fB\-\-recurse\-submodules\fR[\fB=\fR\fI<pathspec>\fR]] [\fB\-\-\fR[\fBno\-\fR]\fBshallow\-submodules\fR]
  41. [\fB\-\-\fR[\fBno\-\fR]\fBremote\-submodules\fR] [\fB\-\-jobs\fR \fI<n>\fR] [\fB\-\-sparse\fR] [\fB\-\-\fR[\fBno\-\fR]\fBreject\-shallow\fR]
  42. [\fB\-\-filter=\fR\fI<filter\-spec>\fR] [\fB\-\-also\-filter\-submodules\fR]] [\fB\-\-\fR] \fI<repository>\fR
  43. [\fI<directory>\fR]
  44. .fi
  45. .SH "DESCRIPTION"
  46. .sp
  47. Clones a repository into a newly created directory, creates remote\-tracking branches for each branch in the cloned repository (visible using \fBgit\fR \fBbranch\fR \fB\-\-remotes\fR), and creates and checks out an initial branch that is forked from the cloned repository\(cqs currently active branch\&.
  48. .sp
  49. After the clone, a plain \fBgit\fR \fBfetch\fR without arguments will update all the remote\-tracking branches, and a \fBgit\fR \fBpull\fR without arguments will in addition merge the remote master branch into the current master branch, if any (this is untrue when \fB\-\-single\-branch\fR is given; see below)\&.
  50. .sp
  51. This default configuration is achieved by creating references to the remote branch heads under \fBrefs/remotes/origin\fR and by initializing \fBremote\&.origin\&.url\fR and \fBremote\&.origin\&.fetch\fR configuration variables\&.
  52. .SH "OPTIONS"
  53. .PP
  54. \fB\-l\fR, \fB\-\-local\fR
  55. .RS 4
  56. When the repository to clone from is on a local machine, this flag bypasses the normal "Git aware" transport mechanism and clones the repository by making a copy of
  57. \fBHEAD\fR
  58. and everything under objects and refs directories\&. The files under \&.\fBgit/objects/\fR
  59. directory are hardlinked to save space when possible\&.
  60. .sp
  61. If the repository is specified as a local path (e\&.g\&.,
  62. \fB/path/to/repo\fR), this is the default, and
  63. \fB\-\-local\fR
  64. is essentially a no\-op\&. If the repository is specified as a URL, then this flag is ignored (and we never use the local optimizations)\&. Specifying
  65. \fB\-\-no\-local\fR
  66. will override the default when
  67. \fB/path/to/repo\fR
  68. is given, using the regular Git transport instead\&.
  69. .sp
  70. If the repository\(cqs
  71. \fB$GIT_DIR/objects\fR
  72. has symbolic links or is a symbolic link, the clone will fail\&. This is a security measure to prevent the unintentional copying of files by dereferencing the symbolic links\&.
  73. .sp
  74. This option does not work with repositories owned by other users for security reasons, and
  75. \fB\-\-no\-local\fR
  76. must be specified for the clone to succeed\&.
  77. .sp
  78. \fBNOTE\fR: this operation can race with concurrent modification to the source repository, similar to running
  79. \fBcp\fR
  80. \fB\-r\fR
  81. \fI<src>\fR
  82. \fI<dst>\fR
  83. while modifying
  84. \fI<src>\fR\&.
  85. .RE
  86. .PP
  87. \fB\-\-no\-hardlinks\fR
  88. .RS 4
  89. Force the cloning process from a repository on a local filesystem to copy the files under the \&.\fBgit/objects\fR
  90. directory instead of using hardlinks\&. This may be desirable if you are trying to make a back\-up of your repository\&.
  91. .RE
  92. .PP
  93. \fB\-s\fR, \fB\-\-shared\fR
  94. .RS 4
  95. When the repository to clone is on the local machine, instead of using hard links, automatically setup \&.\fBgit/objects/info/alternates\fR
  96. to share the objects with the source repository\&. The resulting repository starts out without any object of its own\&.
  97. .sp
  98. \fBNOTE\fR: this is a possibly dangerous operation; do
  99. \fBnot\fR
  100. use it unless you understand what it does\&. If you clone your repository using this option and then delete branches (or use any other Git command that makes any existing commit unreferenced) in the source repository, some objects may become unreferenced (or dangling)\&. These objects may be removed by normal Git operations (such as
  101. \fBgit\fR
  102. \fBcommit\fR) which automatically call
  103. \fBgit\fR
  104. \fBmaintenance\fR
  105. \fBrun\fR
  106. \fB\-\-auto\fR\&. (See
  107. \fBgit-maintenance\fR(1)\&.) If these objects are removed and were referenced by the cloned repository, then the cloned repository will become corrupt\&.
  108. .sp
  109. Note that running
  110. \fBgit\fR
  111. \fBrepack\fR
  112. without the
  113. \fB\-\-local\fR
  114. option in a repository cloned with
  115. \fB\-\-shared\fR
  116. will copy objects from the source repository into a pack in the cloned repository, removing the disk space savings of
  117. \fBclone\fR
  118. \fB\-\-shared\fR\&. It is safe, however, to run
  119. \fBgit\fR
  120. \fBgc\fR, which uses the
  121. \fB\-\-local\fR
  122. option by default\&.
  123. .sp
  124. If you want to break the dependency of a repository cloned with
  125. \fB\-\-shared\fR
  126. on its source repository, you can simply run
  127. \fBgit\fR
  128. \fBrepack\fR
  129. \fB\-a\fR
  130. to copy all objects from the source repository into a pack in the cloned repository\&.
  131. .RE
  132. .PP
  133. \fB\-\-reference\fR[\fB\-if\-able\fR] \fI<repository>\fR
  134. .RS 4
  135. If the reference
  136. \fI<repository>\fR
  137. is on the local machine, automatically setup \&.\fBgit/objects/info/alternates\fR
  138. to obtain objects from the reference
  139. \fI<repository>\fR\&. Using an already existing repository as an alternate will require fewer objects to be copied from the repository being cloned, reducing network and local storage costs\&. When using the
  140. \fB\-\-reference\-if\-able\fR, a non existing directory is skipped with a warning instead of aborting the clone\&.
  141. .sp
  142. \fBNOTE\fR: see the NOTE for the
  143. \fB\-\-shared\fR
  144. option, and also the
  145. \fB\-\-dissociate\fR
  146. option\&.
  147. .RE
  148. .PP
  149. \fB\-\-dissociate\fR
  150. .RS 4
  151. Borrow the objects from reference repositories specified with the
  152. \fB\-\-reference\fR
  153. options only to reduce network transfer, and stop borrowing from them after a clone is made by making necessary local copies of borrowed objects\&. This option can also be used when cloning locally from a repository that already borrows objects from another repository\(em\:the new repository will borrow objects from the same repository, and this option can be used to stop the borrowing\&.
  154. .RE
  155. .PP
  156. \fB\-q\fR, \fB\-\-quiet\fR
  157. .RS 4
  158. Operate quietly\&. Progress is not reported to the standard error stream\&.
  159. .RE
  160. .PP
  161. \fB\-v\fR, \fB\-\-verbose\fR
  162. .RS 4
  163. Run verbosely\&. Does not affect the reporting of progress status to the standard error stream\&.
  164. .RE
  165. .PP
  166. \fB\-\-progress\fR
  167. .RS 4
  168. Progress status is reported on the standard error stream by default when it is attached to a terminal, unless
  169. \fB\-\-quiet\fR
  170. is specified\&. This flag forces progress status even if the standard error stream is not directed to a terminal\&.
  171. .RE
  172. .PP
  173. \fB\-\-server\-option=\fR\fI<option>\fR
  174. .RS 4
  175. Transmit the given string to the server when communicating using protocol version 2\&. The given string must not contain a NUL or LF character\&. The server\(cqs handling of server options, including unknown ones, is server\-specific\&. When multiple
  176. \fB\-\-server\-option=\fR\fI<option>\fR
  177. are given, they are all sent to the other side in the order listed on the command line\&. When no
  178. \fB\-\-server\-option=\fR\fI<option>\fR
  179. is given from the command line, the values of configuration variable
  180. \fBremote\&.\fR\fI<name>\fR\fB\&.serverOption\fR
  181. are used instead\&.
  182. .RE
  183. .PP
  184. \fB\-n\fR, \fB\-\-no\-checkout\fR
  185. .RS 4
  186. No checkout of
  187. \fBHEAD\fR
  188. is performed after the clone is complete\&.
  189. .RE
  190. .PP
  191. \fB\-\-\fR[\fBno\-\fR]\fBreject\-shallow\fR
  192. .RS 4
  193. Fail if the source repository is a shallow repository\&. The
  194. \fBclone\&.rejectShallow\fR
  195. configuration variable can be used to specify the default\&.
  196. .RE
  197. .PP
  198. \fB\-\-bare\fR
  199. .RS 4
  200. Make a
  201. \fIbare\fR
  202. Git repository\&. That is, instead of creating
  203. \fI<directory>\fR
  204. and placing the administrative files in
  205. \fI<directory>\fR\fB/\&.git\fR, make the
  206. \fI<directory>\fR
  207. itself the
  208. \fB$GIT_DIR\fR\&. This obviously implies the
  209. \fB\-\-no\-checkout\fR
  210. because there is nowhere to check out the working tree\&. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to
  211. \fBrefs/remotes/origin/\fR\&. When this option is used, neither remote\-tracking branches nor the related configuration variables are created\&.
  212. .RE
  213. .PP
  214. \fB\-\-sparse\fR
  215. .RS 4
  216. Employ a sparse\-checkout, with only files in the toplevel directory initially being present\&. The
  217. \fBgit-sparse-checkout\fR(1)
  218. command can be used to grow the working directory as needed\&.
  219. .RE
  220. .PP
  221. \fB\-\-filter=\fR\fI<filter\-spec>\fR
  222. .RS 4
  223. Use the partial clone feature and request that the server sends a subset of reachable objects according to a given object filter\&. When using
  224. \fB\-\-filter\fR, the supplied
  225. \fI<filter\-spec>\fR
  226. is used for the partial clone filter\&. For example,
  227. \fB\-\-filter=blob:none\fR
  228. will filter out all blobs (file contents) until needed by Git\&. Also,
  229. \fB\-\-filter=blob:limit=\fR\fI<size>\fR
  230. will filter out all blobs of size at least
  231. \fI<size>\fR\&. For more details on filter specifications, see the
  232. \fB\-\-filter\fR
  233. option in
  234. \fBgit-rev-list\fR(1)\&.
  235. .RE
  236. .PP
  237. \fB\-\-also\-filter\-submodules\fR
  238. .RS 4
  239. Also apply the partial clone filter to any submodules in the repository\&. Requires
  240. \fB\-\-filter\fR
  241. and
  242. \fB\-\-recurse\-submodules\fR\&. This can be turned on by default by setting the
  243. \fBclone\&.filterSubmodules\fR
  244. config option\&.
  245. .RE
  246. .PP
  247. \fB\-\-mirror\fR
  248. .RS 4
  249. Set up a mirror of the source repository\&. This implies
  250. \fB\-\-bare\fR\&. Compared to
  251. \fB\-\-bare\fR,
  252. \fB\-\-mirror\fR
  253. not only maps local branches of the source to local branches of the target, it maps all refs (including remote\-tracking branches, notes etc\&.) and sets up a refspec configuration such that all these refs are overwritten by a
  254. \fBgit\fR
  255. \fBremote\fR
  256. \fBupdate\fR
  257. in the target repository\&.
  258. .RE
  259. .PP
  260. \fB\-o\fR \fI<name>\fR, \fB\-\-origin\fR \fI<name>\fR
  261. .RS 4
  262. Instead of using the remote name
  263. \fBorigin\fR
  264. to keep track of the upstream repository, use
  265. \fI<name>\fR\&. Overrides
  266. \fBclone\&.defaultRemoteName\fR
  267. from the config\&.
  268. .RE
  269. .PP
  270. \fB\-b\fR \fI<name>\fR, \fB\-\-branch\fR \fI<name>\fR
  271. .RS 4
  272. Instead of pointing the newly created
  273. \fBHEAD\fR
  274. to the branch pointed to by the cloned repository\(cqs
  275. \fBHEAD\fR, point to
  276. \fI<name>\fR
  277. branch instead\&. In a non\-bare repository, this is the branch that will be checked out\&.
  278. \fB\-\-branch\fR
  279. can also take tags and detaches the
  280. \fBHEAD\fR
  281. at that commit in the resulting repository\&.
  282. .RE
  283. .PP
  284. \fB\-\-revision=\fR\fI<rev>\fR
  285. .RS 4
  286. Create a new repository, and fetch the history leading to the given revision
  287. \fI<rev>\fR
  288. (and nothing else), without making any remote\-tracking branch, and without making any local branch, and detach
  289. \fBHEAD\fR
  290. to
  291. \fI<rev>\fR\&. The argument can be a ref name (e\&.g\&.
  292. \fBrefs/heads/main\fR
  293. or
  294. \fBrefs/tags/v1\&.0\fR) that peels down to a commit, or a hexadecimal object name\&. This option is incompatible with
  295. \fB\-\-branch\fR
  296. and
  297. \fB\-\-mirror\fR\&.
  298. .RE
  299. .PP
  300. \fB\-u\fR \fI<upload\-pack>\fR, \fB\-\-upload\-pack\fR \fI<upload\-pack>\fR
  301. .RS 4
  302. When given, and the repository to clone from is accessed via ssh, this specifies a non\-default path for the command run on the other end\&.
  303. .RE
  304. .PP
  305. \fB\-\-template=\fR\fI<template\-directory>\fR
  306. .RS 4
  307. Specify the directory from which templates will be used; (See the "TEMPLATE DIRECTORY" section of
  308. \fBgit-init\fR(1)\&.)
  309. .RE
  310. .PP
  311. \fB\-c\fR \fI<key>\fR\fB=\fR\fI<value>\fR, \fB\-\-config\fR \fI<key>\fR\fB=\fR\fI<value>\fR
  312. .RS 4
  313. Set a configuration variable in the newly\-created repository; this takes effect immediately after the repository is initialized, but before the remote history is fetched or any files checked out\&. The
  314. \fI<key>\fR
  315. is in the same format as expected by
  316. \fBgit-config\fR(1)
  317. (e\&.g\&.,
  318. \fBcore\&.eol=true\fR)\&. If multiple values are given for the same key, each value will be written to the config file\&. This makes it safe, for example, to add additional fetch refspecs to the origin remote\&.
  319. .sp
  320. Due to limitations of the current implementation, some configuration variables do not take effect until after the initial fetch and checkout\&. Configuration variables known to not take effect are:
  321. \fBremote\&.\fR\fI<name>\fR\fB\&.mirror\fR
  322. and
  323. \fBremote\&.\fR\fI<name>\fR\fB\&.tagOpt\fR\&. Use the corresponding
  324. \fB\-\-mirror\fR
  325. and
  326. \fB\-\-no\-tags\fR
  327. options instead\&.
  328. .RE
  329. .PP
  330. \fB\-\-depth\fR \fI<depth>\fR
  331. .RS 4
  332. Create a
  333. \fIshallow\fR
  334. clone with a history truncated to the specified number of commits\&. Implies
  335. \fB\-\-single\-branch\fR
  336. unless
  337. \fB\-\-no\-single\-branch\fR
  338. is given to fetch the histories near the tips of all branches\&. If you want to clone submodules shallowly, also pass
  339. \fB\-\-shallow\-submodules\fR\&.
  340. .RE
  341. .PP
  342. \fB\-\-shallow\-since=\fR\fI<date>\fR
  343. .RS 4
  344. Create a shallow clone with a history after the specified time\&.
  345. .RE
  346. .PP
  347. \fB\-\-shallow\-exclude=\fR\fI<ref>\fR
  348. .RS 4
  349. Create a shallow clone with a history, excluding commits reachable from a specified remote branch or tag\&. This option can be specified multiple times\&.
  350. .RE
  351. .PP
  352. \fB\-\-\fR[\fBno\-\fR]\fBsingle\-branch\fR
  353. .RS 4
  354. Clone only the history leading to the tip of a single branch, either specified by the
  355. \fB\-\-branch\fR
  356. option or the primary branch remote\(cqs
  357. \fBHEAD\fR
  358. points at\&. Further fetches into the resulting repository will only update the remote\-tracking branch for the branch this option was used for the initial cloning\&. If the
  359. \fBHEAD\fR
  360. at the remote did not point at any branch when
  361. \fB\-\-single\-branch\fR
  362. clone was made, no remote\-tracking branch is created\&.
  363. .RE
  364. .PP
  365. \fB\-\-\fR[\fBno\-\fR]\fBtags\fR
  366. .RS 4
  367. Control whether or not tags will be cloned\&. When
  368. \fB\-\-no\-tags\fR
  369. is given, the option will be become permanent by setting the
  370. \fBremote\&.\fR\fI<remote>\fR\fB\&.tagOpt=\-\-no\-tags\fR
  371. configuration\&. This ensures that future
  372. \fBgit\fR
  373. \fBpull\fR
  374. and
  375. \fBgit\fR
  376. \fBfetch\fR
  377. won\(cqt follow any tags\&. Subsequent explicit tag fetches will still work (see
  378. \fBgit-fetch\fR(1))\&.
  379. .sp
  380. By default, tags are cloned and passing
  381. \fB\-\-tags\fR
  382. is thus typically a no\-op, unless it cancels out a previous
  383. \fB\-\-no\-tags\fR\&.
  384. .sp
  385. Can be used in conjunction with
  386. \fB\-\-single\-branch\fR
  387. to clone and maintain a branch with no references other than a single cloned branch\&. This is useful e\&.g\&. to maintain minimal clones of the default branch of some repository for search indexing\&.
  388. .RE
  389. .PP
  390. \fB\-\-recurse\-submodules\fR[\fB=\fR\fI<pathspec>\fR]
  391. .RS 4
  392. After the clone is created, initialize and clone submodules within based on the provided
  393. \fI<pathspec>\fR\&. If no
  394. \fB=\fR\fI<pathspec>\fR
  395. is provided, all submodules are initialized and cloned\&. This option can be given multiple times for pathspecs consisting of multiple entries\&. The resulting clone has
  396. \fBsubmodule\&.active\fR
  397. set to the provided pathspec, or "\&." (meaning all submodules) if no pathspec is provided\&.
  398. .sp
  399. Submodules are initialized and cloned using their default settings\&. This is equivalent to running
  400. \fBgit\fR
  401. \fBsubmodule\fR
  402. \fBupdate\fR
  403. \fB\-\-init\fR
  404. \fB\-\-recursive\fR
  405. \fI<pathspec>\fR
  406. immediately after the clone is finished\&. This option is ignored if the cloned repository does not have a worktree/checkout (i\&.e\&. if any of
  407. \fB\-\-no\-checkout\fR/\fB\-n\fR,
  408. \fB\-\-bare\fR, or
  409. \fB\-\-mirror\fR
  410. is given)
  411. .RE
  412. .PP
  413. \fB\-\-\fR[\fBno\-\fR]\fBshallow\-submodules\fR
  414. .RS 4
  415. All submodules which are cloned will be shallow with a depth of 1\&.
  416. .RE
  417. .PP
  418. \fB\-\-\fR[\fBno\-\fR]\fBremote\-submodules\fR
  419. .RS 4
  420. All submodules which are cloned will use the status of the submodule\(cqs remote\-tracking branch to update the submodule, rather than the superproject\(cqs recorded SHA\-1\&. Equivalent to passing
  421. \fB\-\-remote\fR
  422. to
  423. \fBgit\fR
  424. \fBsubmodule\fR
  425. \fBupdate\fR\&.
  426. .RE
  427. .PP
  428. \fB\-\-separate\-git\-dir=\fR\fI<git\-dir>\fR
  429. .RS 4
  430. Instead of placing the cloned repository where it is supposed to be, place the cloned repository at the specified directory, then make a filesystem\-agnostic Git symbolic link to there\&. The result is Git repository can be separated from working tree\&.
  431. .RE
  432. .PP
  433. \fB\-\-ref\-format=\fR\fI<ref\-format>\fR
  434. .RS 4
  435. Specify the given ref storage format for the repository\&. The valid values are:
  436. .sp
  437. .RS 4
  438. .ie n \{\
  439. \h'-04'\(bu\h'+03'\c
  440. .\}
  441. .el \{\
  442. .sp -1
  443. .IP \(bu 2.3
  444. .\}
  445. \fBfiles\fR
  446. for loose files with packed\-refs\&. This is the default\&.
  447. .RE
  448. .sp
  449. .RS 4
  450. .ie n \{\
  451. \h'-04'\(bu\h'+03'\c
  452. .\}
  453. .el \{\
  454. .sp -1
  455. .IP \(bu 2.3
  456. .\}
  457. \fBreftable\fR
  458. for the reftable format\&. This format is experimental and its internals are subject to change\&.
  459. .RE
  460. .RE
  461. .PP
  462. \fB\-j\fR \fI<n>\fR, \fB\-\-jobs\fR \fI<n>\fR
  463. .RS 4
  464. The number of submodules fetched at the same time\&. Defaults to the
  465. \fBsubmodule\&.fetchJobs\fR
  466. option\&.
  467. .RE
  468. .PP
  469. \fI<repository>\fR
  470. .RS 4
  471. The (possibly remote)
  472. \fI<repository>\fR
  473. to clone from\&. See the
  474. GIT URLS
  475. section below for more information on specifying repositories\&.
  476. .RE
  477. .PP
  478. \fI<directory>\fR
  479. .RS 4
  480. The name of a new directory to clone into\&. The "humanish" part of the source repository is used if no
  481. \fI<directory>\fR
  482. is explicitly given (\fBrepo\fR
  483. for
  484. \fB/path/to/repo\&.git\fR
  485. and
  486. \fBfoo\fR
  487. for
  488. \fBhost\&.xz:foo/\&.git\fR)\&. Cloning into an existing directory is only allowed if the directory is empty\&.
  489. .RE
  490. .PP
  491. \fB\-\-bundle\-uri=\fR\fI<uri>\fR
  492. .RS 4
  493. Before fetching from the remote, fetch a bundle from the given
  494. \fI<uri>\fR
  495. and unbundle the data into the local repository\&. The refs in the bundle will be stored under the hidden
  496. \fBrefs/bundle/\fR* namespace\&. This option is incompatible with
  497. \fB\-\-depth\fR,
  498. \fB\-\-shallow\-since\fR, and
  499. \fB\-\-shallow\-exclude\fR\&.
  500. .RE
  501. .SH "GIT URLS"
  502. .sp
  503. In general, URLs contain information about the transport protocol, the address of the remote server, and the path to the repository\&. Depending on the transport protocol, some of this information may be absent\&.
  504. .sp
  505. Git supports ssh, git, http, and https protocols (in addition, ftp and ftps can be used for fetching, but this is inefficient and deprecated; do not use them)\&.
  506. .sp
  507. The native transport (i\&.e\&. \fBgit://\fR URL) does no authentication and should be used with caution on unsecured networks\&.
  508. .sp
  509. The following syntaxes may be used with them:
  510. .sp
  511. .RS 4
  512. .ie n \{\
  513. \h'-04'\(bu\h'+03'\c
  514. .\}
  515. .el \{\
  516. .sp -1
  517. .IP \(bu 2.3
  518. .\}
  519. \fBssh://\fR[\fI<user>\fR\fB@\fR]\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  520. .RE
  521. .sp
  522. .RS 4
  523. .ie n \{\
  524. \h'-04'\(bu\h'+03'\c
  525. .\}
  526. .el \{\
  527. .sp -1
  528. .IP \(bu 2.3
  529. .\}
  530. \fBgit://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  531. .RE
  532. .sp
  533. .RS 4
  534. .ie n \{\
  535. \h'-04'\(bu\h'+03'\c
  536. .\}
  537. .el \{\
  538. .sp -1
  539. .IP \(bu 2.3
  540. .\}
  541. \fBhttp\fR[\fBs\fR]\fB://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  542. .RE
  543. .sp
  544. .RS 4
  545. .ie n \{\
  546. \h'-04'\(bu\h'+03'\c
  547. .\}
  548. .el \{\
  549. .sp -1
  550. .IP \(bu 2.3
  551. .\}
  552. \fBftp\fR[\fBs\fR]\fB://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  553. .RE
  554. .sp
  555. An alternative scp\-like syntax may also be used with the ssh protocol:
  556. .sp
  557. .RS 4
  558. .ie n \{\
  559. \h'-04'\(bu\h'+03'\c
  560. .\}
  561. .el \{\
  562. .sp -1
  563. .IP \(bu 2.3
  564. .\}
  565. [\fI<user>\fR\fB@\fR]\fI<host>\fR\fB:/\fR\fI<path\-to\-git\-repo>\fR
  566. .RE
  567. .sp
  568. This syntax is only recognized if there are no slashes before the first colon\&. This helps differentiate a local path that contains a colon\&. For example the local path \fBfoo:bar\fR could be specified as an absolute path or \&.\fB/foo:bar\fR to avoid being misinterpreted as an ssh url\&.
  569. .sp
  570. The ssh and git protocols additionally support \fB~\fR\fI<username>\fR expansion:
  571. .sp
  572. .RS 4
  573. .ie n \{\
  574. \h'-04'\(bu\h'+03'\c
  575. .\}
  576. .el \{\
  577. .sp -1
  578. .IP \(bu 2.3
  579. .\}
  580. \fBssh://\fR[\fI<user>\fR\fB@\fR]\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/~\fR\fI<user>\fR\fB/\fR\fI<path\-to\-git\-repo>\fR
  581. .RE
  582. .sp
  583. .RS 4
  584. .ie n \{\
  585. \h'-04'\(bu\h'+03'\c
  586. .\}
  587. .el \{\
  588. .sp -1
  589. .IP \(bu 2.3
  590. .\}
  591. \fBgit://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/~\fR\fI<user>\fR\fB/\fR\fI<path\-to\-git\-repo>\fR
  592. .RE
  593. .sp
  594. .RS 4
  595. .ie n \{\
  596. \h'-04'\(bu\h'+03'\c
  597. .\}
  598. .el \{\
  599. .sp -1
  600. .IP \(bu 2.3
  601. .\}
  602. [\fI<user>\fR\fB@\fR]\fI<host>\fR\fB:~\fR\fI<user>\fR\fB/\fR\fI<path\-to\-git\-repo>\fR
  603. .RE
  604. .sp
  605. For local repositories, also supported by Git natively, the following syntaxes may be used:
  606. .sp
  607. .RS 4
  608. .ie n \{\
  609. \h'-04'\(bu\h'+03'\c
  610. .\}
  611. .el \{\
  612. .sp -1
  613. .IP \(bu 2.3
  614. .\}
  615. \fB/path/to/repo\&.git/\fR
  616. .RE
  617. .sp
  618. .RS 4
  619. .ie n \{\
  620. \h'-04'\(bu\h'+03'\c
  621. .\}
  622. .el \{\
  623. .sp -1
  624. .IP \(bu 2.3
  625. .\}
  626. \fBfile:///path/to/repo\&.git/\fR
  627. .RE
  628. .sp
  629. These two syntaxes are mostly equivalent, except the former implies \fB\-\-local\fR option\&.
  630. .sp
  631. \fBgit\fR \fBclone\fR, \fBgit\fR \fBfetch\fR and \fBgit\fR \fBpull\fR, but not \fBgit\fR \fBpush\fR, will also accept a suitable bundle file\&. See \fBgit-bundle\fR(1)\&.
  632. .sp
  633. When Git doesn\(cqt know how to handle a certain transport protocol, it attempts to use the \fBremote\-\fR\fI<transport>\fR remote helper, if one exists\&. To explicitly request a remote helper, the following syntax may be used:
  634. .sp
  635. .RS 4
  636. .ie n \{\
  637. \h'-04'\(bu\h'+03'\c
  638. .\}
  639. .el \{\
  640. .sp -1
  641. .IP \(bu 2.3
  642. .\}
  643. \fI<transport>\fR\fB::\fR\fI<address>\fR
  644. .RE
  645. .sp
  646. where \fI<address>\fR may be a path, a server and path, or an arbitrary URL\-like string recognized by the specific remote helper being invoked\&. See \fBgitremote-helpers\fR(7) for details\&.
  647. .sp
  648. If there are a large number of similarly\-named remote repositories and you want to use a different format for them (such that the URLs you use will be rewritten into URLs that work), you can create a configuration section of the form:
  649. .sp
  650. .if n \{\
  651. .RS 4
  652. .\}
  653. .nf
  654. [url "\fI<actual\-url\-base>\fR"]
  655. insteadOf = \fI<other\-url\-base>\fR
  656. .fi
  657. .if n \{\
  658. .RE
  659. .\}
  660. .sp
  661. For example, with this:
  662. .sp
  663. .if n \{\
  664. .RS 4
  665. .\}
  666. .nf
  667. [url "git://git\&.host\&.xz/"]
  668. insteadOf = host\&.xz:/path/to/
  669. insteadOf = work:
  670. .fi
  671. .if n \{\
  672. .RE
  673. .\}
  674. .sp
  675. a URL like "work:repo\&.git" or like "host\&.xz:/path/to/repo\&.git" will be rewritten in any context that takes a URL to be "git://git\&.host\&.xz/repo\&.git"\&.
  676. .sp
  677. If you want to rewrite URLs for push only, you can create a configuration section of the form:
  678. .sp
  679. .if n \{\
  680. .RS 4
  681. .\}
  682. .nf
  683. [url "\fI<actual\-url\-base>\fR"]
  684. pushInsteadOf = \fI<other\-url\-base>\fR
  685. .fi
  686. .if n \{\
  687. .RE
  688. .\}
  689. .sp
  690. For example, with this:
  691. .sp
  692. .if n \{\
  693. .RS 4
  694. .\}
  695. .nf
  696. [url "ssh://example\&.org/"]
  697. pushInsteadOf = git://example\&.org/
  698. .fi
  699. .if n \{\
  700. .RE
  701. .\}
  702. .sp
  703. a URL like "git://example\&.org/path/to/repo\&.git" will be rewritten to "ssh://example\&.org/path/to/repo\&.git" for pushes, but pulls will still use the original URL\&.
  704. .SH "EXAMPLES"
  705. .sp
  706. .RS 4
  707. .ie n \{\
  708. \h'-04'\(bu\h'+03'\c
  709. .\}
  710. .el \{\
  711. .sp -1
  712. .IP \(bu 2.3
  713. .\}
  714. Clone from upstream:
  715. .sp
  716. .if n \{\
  717. .RS 4
  718. .\}
  719. .nf
  720. $ git clone git://git\&.kernel\&.org/pub/scm/\&.\&.\&./linux\&.git my\-linux
  721. $ cd my\-linux
  722. $ make
  723. .fi
  724. .if n \{\
  725. .RE
  726. .\}
  727. .RE
  728. .sp
  729. .RS 4
  730. .ie n \{\
  731. \h'-04'\(bu\h'+03'\c
  732. .\}
  733. .el \{\
  734. .sp -1
  735. .IP \(bu 2.3
  736. .\}
  737. Make a local clone that borrows from the current directory, without checking things out:
  738. .sp
  739. .if n \{\
  740. .RS 4
  741. .\}
  742. .nf
  743. $ git clone \-l \-s \-n \&. \&.\&./copy
  744. $ cd \&.\&./copy
  745. $ git show\-branch
  746. .fi
  747. .if n \{\
  748. .RE
  749. .\}
  750. .RE
  751. .sp
  752. .RS 4
  753. .ie n \{\
  754. \h'-04'\(bu\h'+03'\c
  755. .\}
  756. .el \{\
  757. .sp -1
  758. .IP \(bu 2.3
  759. .\}
  760. Clone from upstream while borrowing from an existing local directory:
  761. .sp
  762. .if n \{\
  763. .RS 4
  764. .\}
  765. .nf
  766. $ git clone \-\-reference /git/linux\&.git \e
  767. git://git\&.kernel\&.org/pub/scm/\&.\&.\&./linux\&.git \e
  768. my\-linux
  769. $ cd my\-linux
  770. .fi
  771. .if n \{\
  772. .RE
  773. .\}
  774. .RE
  775. .sp
  776. .RS 4
  777. .ie n \{\
  778. \h'-04'\(bu\h'+03'\c
  779. .\}
  780. .el \{\
  781. .sp -1
  782. .IP \(bu 2.3
  783. .\}
  784. Create a bare repository to publish your changes to the public:
  785. .sp
  786. .if n \{\
  787. .RS 4
  788. .\}
  789. .nf
  790. $ git clone \-\-bare \-l /home/proj/\&.git /pub/scm/proj\&.git
  791. .fi
  792. .if n \{\
  793. .RE
  794. .\}
  795. .RE
  796. .sp
  797. .RS 4
  798. .ie n \{\
  799. \h'-04'\(bu\h'+03'\c
  800. .\}
  801. .el \{\
  802. .sp -1
  803. .IP \(bu 2.3
  804. .\}
  805. Clone a local repository from a different user:
  806. .sp
  807. .if n \{\
  808. .RS 4
  809. .\}
  810. .nf
  811. $ git clone \-\-no\-local /home/otheruser/proj\&.git /pub/scm/proj\&.git
  812. .fi
  813. .if n \{\
  814. .RE
  815. .\}
  816. .RE
  817. .SH "CONFIGURATION"
  818. .sp
  819. Everything below this line in this section is selectively included from the \fBgit-config\fR(1) documentation\&. The content is the same as what\(cqs found there:
  820. .PP
  821. \fBinit\&.templateDir\fR
  822. .RS 4
  823. Specify the directory from which templates will be copied\&. (See the "TEMPLATE DIRECTORY" section of
  824. \fBgit-init\fR(1)\&.)
  825. .RE
  826. .PP
  827. \fBinit\&.defaultBranch\fR
  828. .RS 4
  829. Allows overriding the default branch name e\&.g\&. when initializing a new repository\&.
  830. .RE
  831. .PP
  832. \fBinit\&.defaultObjectFormat\fR
  833. .RS 4
  834. Allows overriding the default object format for new repositories\&. See
  835. \fB\-\-object\-format=\fR
  836. in
  837. \fBgit-init\fR(1)\&. Both the command line option and the
  838. \fBGIT_DEFAULT_HASH\fR
  839. environment variable take precedence over this config\&.
  840. .RE
  841. .PP
  842. \fBinit\&.defaultRefFormat\fR
  843. .RS 4
  844. Allows overriding the default ref storage format for new repositories\&. See
  845. \fB\-\-ref\-format=\fR
  846. in
  847. \fBgit-init\fR(1)\&. Both the command line option and the
  848. \fBGIT_DEFAULT_REF_FORMAT\fR
  849. environment variable take precedence over this config\&.
  850. .RE
  851. .PP
  852. \fBclone\&.defaultRemoteName\fR
  853. .RS 4
  854. The name of the remote to create when cloning a repository\&. Defaults to
  855. \fBorigin\fR\&. It can be overridden by passing the
  856. \fB\-\-origin\fR
  857. command\-line option\&.
  858. .RE
  859. .PP
  860. \fBclone\&.rejectShallow\fR
  861. .RS 4
  862. Reject cloning a repository if it is a shallow one; this can be overridden by passing the
  863. \fB\-\-reject\-shallow\fR
  864. option on the command line\&.
  865. .RE
  866. .PP
  867. \fBclone\&.filterSubmodules\fR
  868. .RS 4
  869. If a partial clone filter is provided (see
  870. \fB\-\-filter\fR
  871. in
  872. \fBgit-rev-list\fR(1)) and
  873. \fB\-\-recurse\-submodules\fR
  874. is used, also apply the filter to submodules\&.
  875. .RE
  876. .SH "GIT"
  877. .sp
  878. Part of the \fBgit\fR(1) suite