简体   繁体   English

Git在这些命令中的哪里找到“ .git”?

[英]Where is Git finding the “.git” in these commands?

I'm trying to checkout a tagged release of OpenSSL. 我正在尝试签出带标记的OpenSSL版本。 According to Browse list of tagged releases in a repo? 根据浏览回购中已标记版本的列表? , I located the tagged release with: ,我通过以下方式找到了标记的发行版:

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

According to Checkout remote Git branch , I use git checkout or git fetch to checkout a tagged release. 根据Checkout远程Git分支 ,我使用git checkoutgit fetch来检出标记的发行版。 So I tried checking out the tagged release with the following. 因此,我尝试使用以下方法签出带标签的版本。 Notice the last four commands don't use ".git" anywhere, yet that's what Git is complaining about. 请注意,最后四个命令任何地方都不使用“ .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

Where is Git finding the ".git" in the last four commands ? Git在最后四个命令中在哪里找到“ .git”? How do I issue the commands so that Git does not add ".git" somewhere? 如何发出命令,以使Git不在某处添加“ .git”?

you can't just checkout a tag in git. 您不能只在git中签出标签。 you have to clone the entire repository with 您必须使用以下命令克隆整个存储库

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

and afterwards you can check out the specific tag: 然后,您可以查看特定标签:

git checkout my-tagname

every git repository has one .git folder in it's root, that stores metadata and history of the repository. 每个git存储库的根目录中都有一个.git文件夹,用于存储元数据和存储库的历史记录。 As a decentral version control system, all that info has to be on the client side in order to work, so checking out subtrees is not possible. 作为分散式版本控制系统,所有信息都必须在客户端才能正常工作,因此无法检出子树。

(in contrast to svn, where you have .svn folders everywhere and you can checkout subtrees) (与svn相反,在svn中到处都有.svn文件夹,您可以检出子树)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM