It seems to be an issue with Github, found a discussion here: Unauthenticated clone of a public repo intermittently returns 401 (prompts for Username) from CI workers · community · Discussion #206581 · GitHub
Hey everyone!
Thank you for raising this. We have shared this with our internal teams to investigate - if we have any updates we will post here and in appropriate discussions
As possible workaround, but I would encourage you to wait first, this works:
cd /var/discourse
git config --global http.version HTTP/1.1
./launcher rebuild app
(you might need to rebuild two times because PostgreSQL upgrade)