I've tried many methods to push to my repo, but I keep getting this error:
> git push
remote: Permission to <ACCOUNT_2>/<REPO>.git denied to <ACCOUNT_1>.
fatal: unable to access 'https://github.com/<ACCOUNT_2>/<REPO>.git/': The requested URL returned error: 403
I'm using VS Code to push changes to a repo owned by <ACCOUNT_2>
with <ACCOUNT_2>
's git config name and email.
The error always happens. Is there a way to switch accounts?
I had the same problem before with the opposite accounts, and the solution was to change the git config name and email, and then redownload VS Code.
I expected to be able to push my changes normally, but it's strange that switching to different accounts in Git is so complex. I'm planning on switching accounts many times in the future, so is there a better solution?
Git Output:
2023-08-11 18:21:50.006 [info] > git log --oneline --cherry main...main@{upstream} -- [45ms]
2023-08-11 18:21:50.712 [info] > git pull --tags origin main [702ms]
2023-08-11 18:21:50.712 [info] From https://github.com/<ACCOUNT_2>/<REPO>
* branch main -> FETCH_HEAD
2023-08-11 18:21:51.674 [info] > git push origin main:main [959ms]
2023-08-11 18:21:51.674 [info] remote: Permission to <ACCOUNT_2>/<REPO>.git denied to <ACCOUNT_1>.
fatal: unable to access 'https://github.com/<ACCOUNT_2>/<REPO>.git/': The requested URL returned error: 403