Search code examples
gittagsgoogle-source-repositories

Missing git tags when push to remote repository (e.g. Google Source Repositories)


I have just set up a local git repo and replicated it to a remote repo, based upon a Google "Cloud Source Repository". This mostly worked fine, except that the tags haven't been replicated. I have some older google repos, built in the same way (as far as I can remember), that do have tags. So I'm not sure what is going on.

The process was to:

  • create a local git repo (git 2.17.1 on an ubuntu 18.04 machine),
  • add some files and commit them,
  • add some tags along the lines of git tag -a V1.0.0 -m "The initial working version",
  • update and add some more files (this was for a training guide I'm writing for my team) and add more tags, and
  • then set-up a google repo, connect to it via the Google SDK mechanism, and git push --all google.

All of which seems to have worked fine, except that there are no tags in the remote repo. The output of the git tags command is shown below, and I can see the tags fine in the gitk GUI. So the issue isn't with the local repo. The tags just haven't made it into Google's repos.

Has anyone seen this issue before, or can suggest what I look at next?

$ git tag
V1.0.0
V1.0.1
V1.1.0
V2.0.0

The push output follows: no errors.

git push --all google
Counting objects: 25, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (25/25), 5.03 KiB | 2.51 MiB/s, done.
Total 25 (delta 7), reused 0 (delta 0)
remote: Resolving deltas: 100% (7/7)
To https://source.developers.google.com/p/<REDACTED>/r/git_test
 * [new branch]      master -> master

Solution

  • Thanks to John for pointing out what is expected behaviour! From git-scm.com/book "By default, the git push command doesn’t transfer tags to remote servers."

    So you need an explicit: git push --tags google in my case, or git push --tags origin in the typical case.