I am trying to perform a full git fetch
from my build agent, in order to use GitVersion in TeamCity.
I have opted to use the agent checkout option in TeamCity, as per http://gitversion.readthedocs.io/en/latest/build-server-support/build-server/teamcity/#agent-checkout
However, when I perform a checkout on the agent, I'm unable to get the full git history for a branch. I get the same result as this: https://github.com/GitTools/GitVersion/issues/912 - Specifically:
System.InvalidOperationException: Could not find a 'develop' or 'master' branch, neither locally nor remotely.
My guess is this is because TeamCity is only checking out a subset of the repo history.
The Github issue has a workaround of performing a git fetch
command at the start of every build. Is this something that TeamCity can natively support as part of a VCS root?
Thanks in advance
TeamCity has the ability to fetch all heads TeamCity since v2017, but needs to be enabled via a config setting.
You can configure Git-plugin to fetch all heads by adding a build configuration parameter:
teamcity.git.fetchAllHeads=true.
See here for more details:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With