GitVersion has a few requirements that needs to be met in order to be able to produce a version number. These requirements are enumerated below.
The local (checked out) repository, either on a developer computer or on the build server, needs to adhere to the below requirements.
The repository needs to be an unshallow clone. This means
fetch-depth in GitHub Actions needs to be set to
0, for instance.
Check with your build server to see how it can be configured
The repository needs to have an existing local
For some branch strategies (such as Git Flow), a local
branch needs to exist.
The repository should be switched to a named, existing branch
pointing to the commit being built (i.e. no detached
If using a
GitVersion.yml configuration file, that file
should be checked out otherwise it won't be found by GitVersion and default
config will apply.
If it is ambigous which reference (branch or tag) is being built, which is often
the case on build servers, the
Git_Branch environment variable needs to be
defined and set to the reference being built.