0

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?

Community
  • 1
  • 1
jww
  • 97,681
  • 90
  • 411
  • 885

1 Answers1

2

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)

Matthias
  • 2,622
  • 1
  • 18
  • 29
  • 1
    Well, you can just "checkout" a tag, but `clone` != `checkout`. – loganfsmyth Apr 26 '15 at 20:01
  • You can also `clone -b ` to clone with a detached had based on the passed tag. – CB Bailey Apr 26 '15 at 20:04
  • Agreed, you *could* use this. But git is complicated enough for beginners, Things that create detached heads are not really anything desireful for people who are new to git. – Matthias Apr 26 '15 at 20:09
  • @MatthiasHuttar Well, your answer creates a detached head as well. This is just the way checking out a tag works. – musiKk Apr 27 '15 at 07:43