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

ディレクトリ 検索
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
テキスト

名稱

git-clone  - 將存儲庫克隆到新目錄中

概要

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>]

描述

將存儲庫克隆到新創(chuàng)建的目錄中,為克隆存儲庫中的每個分支創(chuàng)建遠程跟蹤分支(可見使用git branch -r),并創(chuàng)建并簽出分支存儲庫當前活動分支中分支的初始分支。

克隆之后,git fetch沒有參數(shù)的平原將更新所有遠程跟蹤分支,并且git pull如果有的話,一個不帶參數(shù)的遠程主分支將會合并到當前主分支中(當“--single-branch”為給出;見下文)。

這種默認配置是通過創(chuàng)建對遠程分支頭的引用refs/remotes/origin以及通過初始化remote.origin.urlremote.origin.fetch配置變量來實現(xiàn)的。

選項

--local   -l

當要克隆的存儲庫位于本地計算機上時,此標志繞過正常的“Git aware”傳輸機制,并通過復制 HEAD 和對象下的所有內容并引用目錄來克隆存儲庫。.git/objects/如果可能,目錄下的文件被硬鏈接以節(jié)省空間。

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

--no-hardlinks

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

--shared   -s

當要克隆的存儲庫位于本地計算機上時,將自動設置.git/objects/info/alternates為與源存儲庫共享對象,而不是使用硬鏈接。生成的存儲庫首先沒有任何對象。

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

請注意,git repack如果在-l克隆的存儲庫中運行時沒有選項,-s則會將源存儲庫中的對象復制到克隆存儲庫中的包中,從而節(jié)省磁盤空間clone -s。但是,運行是安全的,默認情況下git gc使用該-l選項。

如果要打破克隆-s在其源存儲庫中的存儲庫的依賴關系,可以簡單地運行git repack -a以將源存儲庫中的所有對象復制到克隆存儲庫中的包中。

--reference-if-able <repository>

如果參考存儲庫位于本地計算機上,則自動設置.git/objects/info/alternates為從參考存儲庫獲取對象。將已經存在的存儲庫用作備用存儲庫將需要從正在克隆的存儲庫中復制更少的對象,從而降低網絡和本地存儲成本。使用時--reference-if-able,會跳過一個不存在的目錄,并顯示警告而不是中止克隆。

注意:請參閱--shared選項的注釋,以及--dissociate選項。

--dissociate

借助--reference僅使用選項指定的引用存儲庫借用對象,以減少網絡傳輸,并通過制作所需的借用對象的本地副本,在克隆完成后停止借用它們。當從已經借用另一個存儲庫中的對象的存儲庫本地克隆時,也可以使用此選項 - 新存儲庫將借用同一存儲庫中的對象,并且此選項可用于停止借用。

--quiet   -q

安靜地操作。進度未報告給標準錯誤流。

--verbose   -v

運行詳細。不影響向標準錯誤流報告進度狀態(tài)。

--progress

當連接到終端時,默認情況下,標準錯誤流中會報告進度狀態(tài),除非指定了-q。即使標準錯誤流未定向到終端,此標志也會強制進度狀態(tài)。

--no-checkout   -n

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

--bare

制作一個bareGit 存儲庫。也就是說,不是創(chuàng)建,<directory>并把行政文件<directory>/.git,使<directory>本身$GIT_DIR。這顯然意味著,-n因為沒有地方可以檢查工作樹。此外,遙控器上的分支頭直接復制到相應的本地分支機構頭上,而無需將其映射到refs/remotes/origin/。使用此選項時,不會創(chuàng)建遠程跟蹤分支和相關配置變量。

--mirror

設置源存儲庫的鏡像。這意味著--bare。相比--bare,--mirror不僅映射源到目標的本地分支的地方分支,它映射所有參考文獻(包括遠程跟蹤分支,筆記等),并設置了一個的 Refspec 構造,使得所有這些參考文獻通過覆蓋git remote update在目標存儲庫。

--origin <name>   -o <name>

不要使用遠程名稱origin來跟蹤上游存儲庫,請使用<name>。

--branch <name>   -b <name>

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

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

當給定時,通過 ssh 訪問要克隆的存儲庫,這為另一端運行的命令指定了非默認路徑。

--template=<template_directory>

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

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

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

--depth <depth>

創(chuàng)建一個shallow歷史截斷為指定數(shù)目的提交的克隆。暗示--single-branch除非--no-single-branch給出所有分支的提示附近的歷史。如果你想要簡單地克隆子模塊,也可以通過--shallow-submodules

--shallow-since=<date>

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

--shallow-exclude=<revision>

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

--no-single-branch

只克隆導致單個分支尖端的歷史記錄,無論是由--branch選項指定還是主分支遠程的HEAD指向。進一步提取到生成的存儲庫中將只會更新分支的遠程跟蹤分支,此選項用于初始克隆。如果在--single-branch創(chuàng)建克隆時遠程的 HEAD 沒有指向任何分支,則不會創(chuàng)建遠程跟蹤分支。

--no-tags

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

可以結合使用--single-branch來克隆和維護分支,而不是除單個克隆分支之外的引用。這對于維護某些存儲庫默認分支的最小克隆以實現(xiàn)搜索索引很有用。

--recurse-submodules=<pathspec

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

--no-shallow-submodules

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

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

不要將克隆的存儲庫放置在它應該存在的位置,而應將克隆的存儲庫放置在指定的目錄中,然后創(chuàng)建一個與文件系統(tǒng)無關的 Git 符號鏈接。結果是 Git 倉庫可以從工作樹中分離出來。

-j <n>   --jobs <n>

同時獲取的子模塊的數(shù)量。默認為submodule.fetchJobs選項。

<repository>

(可能是遠程)從中克隆的存儲庫。有關指定存儲庫的更多信息,請參閱下面的 URLS 部分。

<directory>

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

Git urls

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

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

本地傳輸(即 git:// URL)不會進行身份驗證,因此應該謹慎使用不安全的網絡。

以下語法可以與它們一起使用:

  • 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 的語法:

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

  • 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/

對于本地支持的本地存儲庫,可以使用以下語法:

  • /path/to/repo.git/

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

這兩種語法大部分是等價的,除了前者意味著--local 選項。

當 Git 不知道如何處理某個傳輸協(xié)議時,它會嘗試使用remote-<transport>遠程助手(如果存在)。要顯式請求遠程助手,可以使用以下語法:

  • <transport> :: <address>其中<address>可能是一個路徑,一個服務器和路徑,或者是由被調用的特定遠程助手識別的任意類似URL的字符串。有關詳細信息,請參閱 gitremote-helpers [1]。如果存在大量名稱相似的遠程存儲庫,并且您希望為它們使用不同的格式(例如,您使用的URL將被重寫為可工作的URL),則可以創(chuàng)建一個形式的配置部分:                                                   [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

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

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

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

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

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

前の記事: 次の記事: