Everything was working fine, until I create a new GitHub account. When I try to push the code for first time to github server with new account, following error is occurring:
remote: Permission to NEW_USER/NEW_REPO.git denied to OLD_USER.
fatal: unable to access 'https://github.com/NEW_USER/NEW_REPO/': The requested URL returned error: 403
Tried to reset remote url using:
$git remote set-url origin https://[email protected]/user/repo.git
... but not working.
Got one solution here, but for Mac OS. Any ideas how to resolve this.
Using git bash version 2.16.1.windows.4.
Thanks
The first is relatively simple to resolve and simply involves checking to ensure your GitHub password is correct. If the error persists, it is likely that you have to use a different HTTPS address in your Git client. For this error, you will not even be prompted to enter a password, making it simpler to diagnose.
Causes of 403 Forbidden Often, HTTP 403 forbidden errors are caused by an access misconfiguration on the client-side, which means you can usually resolve the issue yourself. A common cause of these errors is the file or folder permission settings, which control who can read, write, and execute the file or folder.
The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it. This status is similar to 401 , but for the 403 Forbidden status code re-authenticating makes no difference.
You may check for the Git Credentials you are using, and change that with your new account.
As the top answer from the question you mentioned says, using a SSH way by
$ git remote set-url origin [email protected]:new_user/new_repo.git
(and set the SSH Key) instead of HTTPS way is also a workaround.
This happens when two git accounts are being used on same machine. On Windows 7 you need to remove git Credentials from Windows vault.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With