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

Re: How to update the tag to Git server?

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 4, 2008, 02:48 UTC
Message-ID
<7v1vwo7j04.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<84437.20577.qm@web37903.mail.mud.yahoo.com>
Gary Yang <garyyang6@yahoo.com> writes:
Show 5 quoted lines
> I pushed code from my local repository to Git Server.
> git push git.company.com:/pub/git/training.git
>
> I, then tagged my local repository.
> git tag -u gyang@company.com RELEASE_2
git-push(1) manual page says that the syntax of the command is:
   'git push' [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
              [--repo=<repository>] [-f | --force] [-v | --verbose]
              [<repository> <refspec>...]
and its OPTIONS section explains what <refspec> means.
<refspec>...::
	The canonical format of a <refspec> parameter is
	`+?<src>:<dst>`; that is, an optional plus `{plus}`, followed
	by the source ref, followed by a colon `:`, followed by
	the destination ref.
	...
        The <src> side represents the source branch (or arbitrary
        "SHA1 expression", such as `master~4` (four parents before the
        tip of `master` branch); see linkgit:git-rev-parse[1]) that you
        want to push.  The <dst> side represents the destination location.

You want to update refs/tags/RELEASE_2 on the destination side (i.e. the public server) with the same refs/tags/RELEASE_2 on the source side (i.e. your side), so you would want to say

	refs/tags/RELEASE_2:refs/tags/RELEASE_2

for <refspec>. The documentation further mentions that there is a short-hand for that:

	`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
Hence the command line becomes:
    $ git push svdcgit01.amcc.com:/pub/git/training.git tag RELEASE_2

Note that saying "tag" is redundant these days as long as you do not have a branch named "RELEASE_2" at the same time. But saying "tag" never hurts, as it is still (and will be) supported.

Note to people who teach git to new people. The moral of the story is not that people should learn to read the manual pages. It is that people should not learn "push" without remote nor refspec first. In other words, the first push command you teach them should be the "git push $over_there $this_refspec" form, fully spelled.

Previous: Peter Harris
Message 3 of 3 in “How to update the tag to Git server?”
  1. Gary YangDec 4, 2008
  2. Peter HarrisDec 4, 2008
  3. Junio C HamanoDec 4, 2008

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.