git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git Tags

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 29, 2018, 15:09 UTC
Message-ID
<87woovyl6i.fsf@evledraar.gmail.com>
In-Reply-To
<c8fc0da2-c3ff-4985-e4a2-a066a3a6f2af@peter-speer.de>
On Thu, Nov 29 2018, Stefanie Leisestreichler wrote:
Show 22 quoted lines
> Hi.
>
> I have done this (on box A):
>
> git commit -m "Message"
> git tag -a 0.9.0
> git push origin master
>
> In my local repository, when I run "git tag" it is showing me "0.9.0".
>
> Then I did (on box B)
> git clone ssh://user@host:/path/project.git
> cd project
> git tag
>
> Now git tag is showing nothing.
>
> Why is the tag only available in my local repository?
>
> Also when I try to
> git clone --branch 0.9.0 ssh://user@host:/path/project.git
> it tells me: fatal:remote branch not found in upstream repository origin

Because --branch <name> means get refs/heads/<name>, tags are not branches. However, because we're apparently quite loose about this in the clone/fetch code this does give you the tag if it exists, but probably not in the way you expect.

We interpret the argument as a branch, and will get not only this tag but "follow" (see --no-tags in git-fetch(1)) the tag as though it were a branch and give you all tags leading up to that one. This would give you a single tag:

    git clone --no-tags --branch v2.19.0 --single-branch https://github.com/git/git.git
But this is a more direct way to do it:
    git init git; git -C git fetch --no-tags https://github.com/git/git.git tag v2.19.0

Which'll since you said it failed that's because you haven't pushed the tag. Try 'git ls-remote <url>' to see if it's there (it's not).

Previous: Mateusz Loskot
Message 5 of 5 in “Git Tags”
  1. Stefanie LeisestreichlerNov 29, 2018
  2. Mateusz LoskotNov 29, 2018
  3. Randall S. BeckerNov 29, 2018
  4. Mateusz LoskotNov 29, 2018
  5. Ævar Arnfjörð BjarmasonNov 29, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.