Unable to rebuild discourse

You should have seen something like this:

# git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

so I think somehow your /var/discourse directory is broken - is no longer connected to the repo. Did you somehow tidy up, lose, or rename the .git subfolder?