For me, the error was caused because git did not get installed in the devcontainer, because I had made changes that accidentally switched the architecture of the docker images without ever making any changes to specify it back to how it was before.
So adding this property in .devcontainer/docker-compose.yml under services: appName: fixed it
platform: linux/amd64