How to force TeamCity to fetch all tags in git repo?


How to force TeamCity to fetch all tags? What I tried so far:

  • force checkout on agent
  • add parameter teamcity.git.fetchAllHeads=true
  • Enable to use tags in the branch specification is checked
  • add +:refs/tags/* into branch specification in VCS root settings
  • I tried to add build step to invoke git fetch --tags but that requires SSH Agent to be running and it's failing with Failed to start SSH Agent: java.lang.RuntimeException: Cannot parse ssh-agent output: ''

Nothing works. I can see that TeamCity is fetching all branches, but no tags, so GitVersion is not able to calculate proper version.

1 comment
Comment actions Permalink

You should only need to add +:refs/tags/* to the branch specification and check the box for Enable to use tags in the branch specification. If you try to run a custom build, do you see the tags listed in the Changes | Build Branch drop-down?


Also, what version of TeamCity are you using? There is a build feature that you may use to connect with an SSH Agent in the latest releases. This would enable you to run the git fetch --tags to a build step in your case.


Please sign in to leave a comment.