VCS in PyCharm works with one Github account but not the other

Answered

Hi,

When I first started using VCS with Pycharm, I signed in with my alternate Github account for testing purposes. Now if I try to use my other (main) account, and try to push anything to a remote repo I get the following error:

Push failed: Failed with error: unable to access '(repo url)': The requested URL returned error: 403

Also when I try to create a repo using the Share on Github function with my main account, it will create the empty repo online, but any time I try to push anything to it, it fails.

Pushing, pulling and creating repos all work fine when I'm using my alternate Github account with Pycharm, but whenever I try to use my main one I get these problems. I have tried changing my Github account info in the Pycharm settings, as well as changing the global user.name and email settings in Git from the command line, but it doesn't make a difference.

Can anyone help? Thanks.

0
2 comments

IDE uses stand-alone git client, and it seems like git client itself has cached credentials of your alternate account and tries using it whenever you do any operation with GitHub. If so, then you will get the same behavior in command line.

To test it check if it asks you for a password upon accessing the GitHub from the command line.

If it is the case, try clearing the saved crednetials from git credential.helper (the procedure would wary based on the system and helper you use).

Alternatively, disable credential helper for the current project by executing

git config credential.helper ""

or entirely for all git repositories by executing

git config --unset-all credential.helper

 

 

0
Avatar
Permanently deleted user

Thanks, I solved the problem by deleting my alternate account (which I do not use anyway) from Github.

0

Please sign in to leave a comment.