Git push error: repository not found

Problem

1 minute ago, I can successfully git push my code to my github private repo. Next minute I tried to push another change, got this error:

1
2
remote: Repository not found.
fatal: repository 'https://github.com/xxx/yyy.git/' not found

Solution

1
2
3
git remote rm origin
git remote add origin https://<personal access token>@github.com/xxx/yyy.git
git push --set-upstream origin main

Then try git status and git pushagain.

Reference: