jww
jww

Reputation: 102376

Where is Git finding the ".git" in these commands?

I'm trying to checkout a tagged release of 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. 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 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? How do I issue the commands so that Git does not add ".git" somewhere?

Upvotes: 0

Views: 114

Answers (1)

Matthias
Matthias

Reputation: 2775

you can't just checkout a tag in 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. 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)

Upvotes: 2

Related Questions