I\'m using git 1.7.1 on Ubuntu 10.10 amd64, and I\'m trying to extract the hash of my repository HEAD to use it in an automated version information that I compile into my pr
This happens if you don't have any tags in your repository. If the repository does have tags, then you're in a shallow clone (this is the default in CI systems like TravisCI or GitHub Actions).
To fetch the history (including tags) from within a shallow clone, run
git fetch --prune --unshallow
For example, in the case of GitHub actions:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
Afterwards, git describe
should work again.