If you are using GitVersion with NUKE and you are trying to get the pipeline working, but are running into the build failing with Could not inject value for GitVersion
.
I will assume you are using a YAML pipeline (and in my case I was pulling the sources from GitHub), try this.
First open the pipeline that is experiencing issues and go select ‘Edit’:

Select the additional settings that are collapsed and go to ‘Triggers’:

Once there, select YAML and the repository and make sure that ‘Shallow fetch’ is disabled.

This solved the issue for me and GitVersion started working as expected.