亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Verzeichnis suchen
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
Figuren

名稱

git-clone  - 將存儲(chǔ)庫(kù)克隆到新目錄中

概要

git clone [--template=<template_directory>]          [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]          [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]          [--dissociate] [--separate-git-dir <git dir>]          [--depth <depth>] [--[no-]single-branch] [--no-tags]          [--recurse-submodules] [--[no-]shallow-submodules]          [--jobs <n>] [--] <repository> [<directory>]

描述

將存儲(chǔ)庫(kù)克隆到新創(chuàng)建的目錄中,為克隆存儲(chǔ)庫(kù)中的每個(gè)分支創(chuàng)建遠(yuǎn)程跟蹤分支(可見(jiàn)使用git branch -r),并創(chuàng)建并簽出分支存儲(chǔ)庫(kù)當(dāng)前活動(dòng)分支中分支的初始分支。

克隆之后,git fetch沒(méi)有參數(shù)的平原將更新所有遠(yuǎn)程跟蹤分支,并且git pull如果有的話,一個(gè)不帶參數(shù)的遠(yuǎn)程主分支將會(huì)合并到當(dāng)前主分支中(當(dāng)“--single-branch”為給出;見(jiàn)下文)。

這種默認(rèn)配置是通過(guò)創(chuàng)建對(duì)遠(yuǎn)程分支頭的引用refs/remotes/origin以及通過(guò)初始化remote.origin.urlremote.origin.fetch配置變量來(lái)實(shí)現(xiàn)的。

選項(xiàng)

--local   -l

當(dāng)要克隆的存儲(chǔ)庫(kù)位于本地計(jì)算機(jī)上時(shí),此標(biāo)志繞過(guò)正常的“Git aware”傳輸機(jī)制,并通過(guò)復(fù)制 HEAD 和對(duì)象下的所有內(nèi)容并引用目錄來(lái)克隆存儲(chǔ)庫(kù)。.git/objects/如果可能,目錄下的文件被硬鏈接以節(jié)省空間。

如果存儲(chǔ)庫(kù)被指定為本地路徑(例如,/path/to/repo),這是默認(rèn)的,并且 -   local 本質(zhì)上是沒(méi)有操作的。如果存儲(chǔ)庫(kù)被指定為 URL,那么該標(biāo)志將被忽略(并且我們從不使用本地優(yōu)化)。指定--no-local將在/path/to/repo給定時(shí)重寫默認(rèn)值,而不是使用常規(guī) Git 傳輸。

--no-hardlinks

強(qiáng)制從本地文件系統(tǒng)的存儲(chǔ)庫(kù)復(fù)制進(jìn)程,以復(fù)制目錄下的.git/objects文件而不是使用硬鏈接。如果您試圖對(duì)存儲(chǔ)庫(kù)進(jìn)行備份,這可能是可取的。

--shared   -s

當(dāng)要克隆的存儲(chǔ)庫(kù)位于本地計(jì)算機(jī)上時(shí),將自動(dòng)設(shè)置.git/objects/info/alternates為與源存儲(chǔ)庫(kù)共享對(duì)象,而不是使用硬鏈接。生成的存儲(chǔ)庫(kù)首先沒(méi)有任何對(duì)象。

注意:這是一個(gè)可能危險(xiǎn)的操作;除非你了解它你不要使用它。如果您使用此選項(xiàng)克隆存儲(chǔ)庫(kù),然后刪除源存儲(chǔ)庫(kù)中的分支(或使用任何其他Git命令使任何現(xiàn)有的未提交的提交未引用),則某些對(duì)象可能會(huì)變?yōu)槲匆茫ɑ驊覓欤?。這些對(duì)象可能被git commit自動(dòng)調(diào)用的普通 Git 操作(如)刪除git gc --auto。(請(qǐng)參閱 git-gc [1]。)如果這些對(duì)象被刪除并被克隆存儲(chǔ)庫(kù)引用,則克隆的存儲(chǔ)庫(kù)將會(huì)損壞。

請(qǐng)注意,git repack如果在-l克隆的存儲(chǔ)庫(kù)中運(yùn)行時(shí)沒(méi)有選項(xiàng),-s則會(huì)將源存儲(chǔ)庫(kù)中的對(duì)象復(fù)制到克隆存儲(chǔ)庫(kù)中的包中,從而節(jié)省磁盤空間clone -s。但是,運(yùn)行是安全的,默認(rèn)情況下git gc使用該-l選項(xiàng)。

如果要打破克隆-s在其源存儲(chǔ)庫(kù)中的存儲(chǔ)庫(kù)的依賴關(guān)系,可以簡(jiǎn)單地運(yùn)行git repack -a以將源存儲(chǔ)庫(kù)中的所有對(duì)象復(fù)制到克隆存儲(chǔ)庫(kù)中的包中。

--reference-if-able <repository>

如果參考存儲(chǔ)庫(kù)位于本地計(jì)算機(jī)上,則自動(dòng)設(shè)置.git/objects/info/alternates為從參考存儲(chǔ)庫(kù)獲取對(duì)象。將已經(jīng)存在的存儲(chǔ)庫(kù)用作備用存儲(chǔ)庫(kù)將需要從正在克隆的存儲(chǔ)庫(kù)中復(fù)制更少的對(duì)象,從而降低網(wǎng)絡(luò)和本地存儲(chǔ)成本。使用時(shí)--reference-if-able,會(huì)跳過(guò)一個(gè)不存在的目錄,并顯示警告而不是中止克隆。

注意:請(qǐng)參閱--shared選項(xiàng)的注釋,以及--dissociate選項(xiàng)。

--dissociate

借助--reference僅使用選項(xiàng)指定的引用存儲(chǔ)庫(kù)借用對(duì)象,以減少網(wǎng)絡(luò)傳輸,并通過(guò)制作所需的借用對(duì)象的本地副本,在克隆完成后停止借用它們。當(dāng)從已經(jīng)借用另一個(gè)存儲(chǔ)庫(kù)中的對(duì)象的存儲(chǔ)庫(kù)本地克隆時(shí),也可以使用此選項(xiàng) - 新存儲(chǔ)庫(kù)將借用同一存儲(chǔ)庫(kù)中的對(duì)象,并且此選項(xiàng)可用于停止借用。

--quiet   -q

安靜地操作。進(jìn)度未報(bào)告給標(biāo)準(zhǔn)錯(cuò)誤流。

--verbose   -v

運(yùn)行詳細(xì)。不影響向標(biāo)準(zhǔn)錯(cuò)誤流報(bào)告進(jìn)度狀態(tài)。

--progress

當(dāng)連接到終端時(shí),默認(rèn)情況下,標(biāo)準(zhǔn)錯(cuò)誤流中會(huì)報(bào)告進(jìn)度狀態(tài),除非指定了-q。即使標(biāo)準(zhǔn)錯(cuò)誤流未定向到終端,此標(biāo)志也會(huì)強(qiáng)制進(jìn)度狀態(tài)。

--no-checkout   -n

克隆完成后,不執(zhí)行HEAD簽出。

--bare

制作一個(gè)bareGit 存儲(chǔ)庫(kù)。也就是說(shuō),不是創(chuàng)建,<directory>并把行政文件<directory>/.git,使<directory>本身$GIT_DIR。這顯然意味著,-n因?yàn)闆](méi)有地方可以檢查工作樹。此外,遙控器上的分支頭直接復(fù)制到相應(yīng)的本地分支機(jī)構(gòu)頭上,而無(wú)需將其映射到refs/remotes/origin/。使用此選項(xiàng)時(shí),不會(huì)創(chuàng)建遠(yuǎn)程跟蹤分支和相關(guān)配置變量。

--mirror

設(shè)置源存儲(chǔ)庫(kù)的鏡像。這意味著--bare。相比--bare,--mirror不僅映射源到目標(biāo)的本地分支的地方分支,它映射所有參考文獻(xiàn)(包括遠(yuǎn)程跟蹤分支,筆記等),并設(shè)置了一個(gè)的 Refspec 構(gòu)造,使得所有這些參考文獻(xiàn)通過(guò)覆蓋git remote update在目標(biāo)存儲(chǔ)庫(kù)。

--origin <name>   -o <name>

不要使用遠(yuǎn)程名稱origin來(lái)跟蹤上游存儲(chǔ)庫(kù),請(qǐng)使用<name>。

--branch <name>   -b <name>

而不是將新創(chuàng)建的 HEAD 指向克隆存儲(chǔ)庫(kù) HEAD 指向的<name>分支,而是指向分支。在非裸倉(cāng)庫(kù)中,這是將被檢出的分支。--branch也可以在生成的存儲(chǔ)庫(kù)中提交標(biāo)簽并分離 HEAD。

--upload-pack <upload-pack>   -u <upload-pack>

當(dāng)給定時(shí),通過(guò) ssh 訪問(wèn)要克隆的存儲(chǔ)庫(kù),這為另一端運(yùn)行的命令指定了非默認(rèn)路徑。

--template=<template_directory>

指定將使用模板的目錄; (請(qǐng)參閱 git-init [1]的“TEMPLATE DIRECTORY”部分。)

--config <key>=<value>   -c <key>=<value>

在新創(chuàng)建的存儲(chǔ)庫(kù)中設(shè)置配置變量; 這會(huì)在儲(chǔ)存庫(kù)初始化之后立即生效,但是在獲取遠(yuǎn)程歷史記錄或檢出任何文件之前。關(guān)鍵是與 git-config [1]預(yù)期的格式相同(例如,core.eol=true)。如果為同一個(gè)鍵指定了多個(gè)值,則每個(gè)值都將寫入配置文件。例如,這可以安全地將其他提取參數(shù)添加到原始遠(yuǎn)程。

--depth <depth>

創(chuàng)建一個(gè)shallow歷史截?cái)酁橹付〝?shù)目的提交的克隆。暗示--single-branch除非--no-single-branch給出所有分支的提示附近的歷史。如果你想要簡(jiǎn)單地克隆子模塊,也可以通過(guò)--shallow-submodules。

--shallow-since=<date>

在指定時(shí)間后創(chuàng)建一個(gè)具有歷史記錄的淺表克隆。

--shallow-exclude=<revision>

創(chuàng)建具有歷史記錄的淺層克隆,但不包括從指定遠(yuǎn)程分支或標(biāo)記可訪問(wèn)的提交。該選項(xiàng)可以多次指定。

--no-single-branch

只克隆導(dǎo)致單個(gè)分支尖端的歷史記錄,無(wú)論是由--branch選項(xiàng)指定還是主分支遠(yuǎn)程的HEAD指向。進(jìn)一步提取到生成的存儲(chǔ)庫(kù)中將只會(huì)更新分支的遠(yuǎn)程跟蹤分支,此選項(xiàng)用于初始克隆。如果在--single-branch創(chuàng)建克隆時(shí)遠(yuǎn)程的 HEAD 沒(méi)有指向任何分支,則不會(huì)創(chuàng)建遠(yuǎn)程跟蹤分支。

--no-tags

不要克隆任何標(biāo)簽,并remote.<remote>.tagOpt=--no-tags在配置中設(shè)置,確保將來(lái)git pullgit fetch操作不會(huì)跟隨任何標(biāo)簽。后續(xù)顯式標(biāo)記提取仍然有效,(請(qǐng)參閱 git-fetch [1])。

可以結(jié)合使用--single-branch來(lái)克隆和維護(hù)分支,而不是除單個(gè)克隆分支之外的引用。這對(duì)于維護(hù)某些存儲(chǔ)庫(kù)默認(rèn)分支的最小克隆以實(shí)現(xiàn)搜索索引很有用。

--recurse-submodules=<pathspec

創(chuàng)建克隆后,根據(jù)提供的 pathspec 初始化和克隆子模塊。如果未提供 pathspec,則將初始化并克隆所有子模塊。子模塊使用其默認(rèn)設(shè)置進(jìn)行初始化和克隆。生成的克隆已submodule.active設(shè)置為提供的 pathspec 或“?!?(意思是所有子模塊),如果沒(méi)有提供 pathspec。這相當(dāng)于git submodule update --init --recursive克隆完成后立即運(yùn)行。如果克隆庫(kù)不具有 worktree /結(jié)帳忽略此選項(xiàng)(即如果任何的--no-checkout/ -n--bare--mirror給出)

--no-shallow-submodules

所克隆的所有子模塊將會(huì)變淺,深度為1。

--separate-git-dir=<git dir>

不要將克隆的存儲(chǔ)庫(kù)放置在它應(yīng)該存在的位置,而應(yīng)將克隆的存儲(chǔ)庫(kù)放置在指定的目錄中,然后創(chuàng)建一個(gè)與文件系統(tǒng)無(wú)關(guān)的 Git 符號(hào)鏈接。結(jié)果是 Git 倉(cāng)庫(kù)可以從工作樹中分離出來(lái)。

-j <n>   --jobs <n>

同時(shí)獲取的子模塊的數(shù)量。默認(rèn)為submodule.fetchJobs選項(xiàng)。

<repository>

(可能是遠(yuǎn)程)從中克隆的存儲(chǔ)庫(kù)。有關(guān)指定存儲(chǔ)庫(kù)的更多信息,請(qǐng)參閱下面的 URLS 部分。

<directory>

要克隆到的新目錄的名稱。如果沒(méi)有明確指定目錄(repofor /path/to/repo.gitfoofor host.xz:foo/.git),則使用源代碼庫(kù)的“人道”部分。只有當(dāng)目錄為空時(shí)才允許克隆到現(xiàn)有目錄。

Git urls

通常,URL 包含有關(guān)傳輸協(xié)議,遠(yuǎn)程服務(wù)器地址和存儲(chǔ)庫(kù)路徑的信息。根據(jù)傳輸協(xié)議,這些信息可能不存在。

Git 支持 ssh,git,http和https 協(xié)議(另外,ftp 和 ftps 可以用于抓取,但效率不高,不推薦使用;不要使用它)。

本地傳輸(即 git:// URL)不會(huì)進(jìn)行身份驗(yàn)證,因此應(yīng)該謹(jǐn)慎使用不安全的網(wǎng)絡(luò)。

以下語(yǔ)法可以與它們一起使用:

  • ssh://user@host.xz:port/path/to/repo.git/

  • git://host.xz:port/path/to/repo.git/

  • https://host.xz:port/path/to/repo.git/

  • ftps://host.xz:port/path/to/repo.git/

ssh 協(xié)議也可以使用另一種類似 scp 的語(yǔ)法:

  • user@host.xz:path/to/repo.git/只有在第一個(gè)冒號(hào)前沒(méi)有斜線時(shí)才能識(shí)別此語(yǔ)法。這有助于區(qū)分包含冒號(hào)的本地路徑。例如,本地路徑foo:bar可以被指定為絕對(duì)路徑或./foo:bar避免被誤解為 ssh url。ssh 和 git 協(xié)議還支持?用戶名擴(kuò)展:

  • ssh://user@host.xz:port/~user/path/to/repo.git/

  • git://host.xz:port/~user/path/to/repo.git/

  • user@host.xz:/~user/path/to/repo.git/

對(duì)于本地支持的本地存儲(chǔ)庫(kù),可以使用以下語(yǔ)法:

  • /path/to/repo.git/

  • file:///path/to/repo.git/

這兩種語(yǔ)法大部分是等價(jià)的,除了前者意味著--local 選項(xiàng)。

當(dāng) Git 不知道如何處理某個(gè)傳輸協(xié)議時(shí),它會(huì)嘗試使用remote-<transport>遠(yuǎn)程助手(如果存在)。要顯式請(qǐng)求遠(yuǎn)程助手,可以使用以下語(yǔ)法:

  • <transport> :: <address>其中<address>可能是一個(gè)路徑,一個(gè)服務(wù)器和路徑,或者是由被調(diào)用的特定遠(yuǎn)程助手識(shí)別的任意類似URL的字符串。有關(guān)詳細(xì)信息,請(qǐng)參閱 gitremote-helpers [1]。如果存在大量名稱相似的遠(yuǎn)程存儲(chǔ)庫(kù),并且您希望為它們使用不同的格式(例如,您使用的URL將被重寫為可工作的URL),則可以創(chuàng)建一個(gè)形式的配置部分:                                                   [url "<actual url base>"]

insteadOf = <other url base>For example, with this:        [url "git://git.host.xz/"]                                                                                              insteadOf = host.xz:/path/to/                                                            insteadOf = work: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".If you want to rewrite URLs for push only, you can create a configuration section of the form:        [url "<actual url base>"]                                                                                                      pushInsteadOf = <other url base>For example, with this:        [url "ssh://example.org/"]                                                                                pushInsteadOf = git://example.org/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.Examples


  • 從上游克?。?/p>

$ git clone git://git.kernel.org/pub/scm/.../linux.git my-linux $ cd my-linux $ make

  • 制作一個(gè)從當(dāng)前目錄借用的本地克隆,而不檢查事情:$ git clone -l -s -n。../copy $ cd ../copy $ git show-branch

  • 從現(xiàn)有本地目錄借用時(shí)從上游克?。?/p>

$ git clone --reference /git/linux.git \         git://git.kernel.org/pub/scm/.../linux.git \         my-linux $ cd my-linux

  • 創(chuàng)建一個(gè)裸存儲(chǔ)庫(kù),將公布的更改發(fā)布給公眾:

$ git clone --bare -l /home/proj/.git /pub/scm/proj.git

Vorheriger Artikel: N?chster Artikel: