When the git server has some caching issue, git ls-remote and git fetch may get inconsistent commits. Later this leads failure in the command git reset --hard <COMMIT>.
The failure can be avoid by adding a validation after git fetch. If the local head commit is different from the result of git ls-remote, it should retry or wait for the next sync.