2015-04-26 53 views
0

我正在嘗試簽出OpenSSL的標籤發佈。據Browse list of tagged releases in a repo?,我位於與發佈標籤:Git在這些命令中找到「.git」在哪裏?

git ls-remote --tags git://git.openssl.org/openssl.git 
... 
ab2de707f72a82e0294bae08cca97455b635a656 refs/tags/OpenSSL_1_0_2a 
... 

Checkout remote Git branch,我用git checkoutgit fetch檢出一個發佈標籤。所以我試着用下面的內容檢查標籤發佈。注意最後四個命令不是在任何地方都使用「.git」,但這就是Git所抱怨的。

$ git clone git://git.openssl.org/openssl.git/refs/tags/OpenSSL_1_0_2a 
Cloning into 'OpenSSL_1_0_2a'... 
fatal: Could not read from remote repository. 

$ git clone git://git.openssl.org/refs/tags/OpenSSL_1_0_2a 
Cloning into 'OpenSSL_1_0_2a'... 
fatal: remote error: access denied or repository not exported: /refs/tags/OpenSSL_1_0_2a 

$ git fetch git://git.openssl.org/openssl.git/refs/tags/OpenSSL_1_0_2a 
fatal: Not a git repository (or any of the parent directories): .git 

$ git checkout git://git.openssl.org/openssl.git/refs/tags/OpenSSL_1_0_2a 
fatal: Not a git repository (or any of the parent directories): .git 

$ git fetch git://git.openssl.org/refs/tags/OpenSSL_1_0_2a 
fatal: Not a git repository (or any of the parent directories): .git 

$ git checkout git://git.openssl.org/refs/tags/OpenSSL_1_0_2a 
fatal: Not a git repository (or any of the parent directories): .git 

$ git checkout git://git.openssl.org refs/tags/OpenSSL_1_0_2a 
fatal: Not a git repository (or any of the parent directories): .git 
$ git fetch git://git.openssl.org refs/tags/OpenSSL_1_0_2a 

fatal: Not a git repository (or any of the parent directories): .git 

是在哪裏找到的Git在最後四個命令的 「git的」?如何發佈命令以便Git不會在某處添加「.git」?

回答

2

你不能只是在git中檢出標籤。你有

git clone git://git.openssl.org/openssl.git 

克隆整個倉庫,之後您可以檢查出特定的標籤:

git checkout my-tagname 

每一個git倉庫中有一個git的文件夾的根目錄,其存儲元數據和歷史存儲庫。作爲一個分散的版本控制系統,所有這些信息必須在客戶端才能工作,因此檢查子樹是不可能的。

(對比SVN,你到處都.svn目錄,你可以檢出子樹)

+1

好吧,你可以「結賬」標籤,但'clone'!='checkout'。 – loganfsmyth

+0

你也可以'克隆-b '克隆一個基於傳遞的標籤的分離的had。 –

+0

同意,你*可以*使用這個。但git對初學者來說已經夠複雜的了,創建獨立頭的東西對於那些剛入門的人來說並不是什麼有意義的東西。 –