Since since 2021 Github supports PAT rather than name/password (read here how to create and use one) so we just add it into the remote origin.
On Windows
Visit .git folder and open config file for editing. Eg. vim config.
Change your URL from
https://github.com/<username>/<repo_name>.git
to
https://[personal-access-token]@github.com/<username>/<repo_name>.git
Where [personal-access-token] is the PAT hash you've created at github.
Save the config file and now the push should work.
Shortcut:
git remote remove origin
git remote add origin https://[personal-access-token]@github.com/username/repo_name.git