We have recently moved from Team Foundation Server (TFS) source control to Git source control. We are using TeamCity as our build server.

Our build number format in TeamCity is defined as this:


This gives us a build number like this:

But after moving to GIT our build number looks like this:

Can anyone tell me how to setup TeamCity to generate build number like this when using GIT source control:

  • 1
    That 4d549289e564929454d1e783319e2c3e5b45cd71 is most likely the Git hash for that commit/version of the deployed code. I would recommend seeing if build.vcs.number can be shortened to 7 characters (the typical short has Git uses) for your purposes. Look here for documentation. – Giacomo1968 Aug 22 '19 at 12:14
  • 1
    Thanks i will try that! – bala Aug 22 '19 at 12:30

Currently, the short version of the Git commit hash isn't available via a predefined build parameter. There is a related feature request in TeamCity issue tracker though: https://youtrack.jetbrains.com/issue/TW-22082.

From from a comment in the tracker, the current workaround is to get the necessary hash inside the build script from the passed revision and change the build number via a service message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.