Lastmod from GitInfo shows correctly with hugo serve locally, but is overwritten on Cloudflare pages deploy

I suspect that Cloudflare performs a shallow clone.

Check out this article by @bwintx. For Cloudflare pages he recommends:

git fetch --unshallow && hugo --whatever --flags --you --need