GitVersion can be used through one of its many published Docker containers. The list of available containers can be found on Docker Hub. Once you've found the image you want to use, you can run it like this:
docker run --rm --volume "$(pwd):/repo" gittools/gitversion:6.0.0-fedora.36-6.0 /repo
The above command will run GitVersion with the current directory
mapped to /repo
inside the container (the
--volume "$(pwd):/repo"
part). The
/repo
directory is then passed in as the argument
GitVersion should use to calculate the version.
The --rm
flag will remove the container after it has
finished running.