Github user seems to "stick" with old user name and is not using new user as set in settings of PyCharm

Dear all,
I used to use the Github userid of a collegue, let's say his Github name is "arc". PyCharm worked fine, one could make a project and with a click create a repository, with files, on Github. Now I have my own userid on Github, mzaanen, and I have adjusted the settings in Pycharm accordingly (file, Project settings, Version Control, GitHub). Now, when I create a project in PyCharm and send it to Github, it does make the repository, however, when trying to upload the files:

23:41:56.830: cd E:\djangoprojects_hp_17\test
23:41:56.832: git init
Initialized empty Git repository in E:/djangoprojects_hp_17/test/.git/
23:42:04.054: cd E:\djangoprojects_hp_17\test
23:42:04.055: git add –ignore-errors –
23:42:04.152: cd E:\djangoprojects_hp_17\test
23:42:04.153: git commit -m "Initial commit" –
[master (root-commit) e42e12c] Initial commit
1 file changed, 2 insertions(+)
create mode 100644
23:42:04.321: cd E:\djangoprojects_hp_17\test
23:42:04.322: git push –progress origin master –set-upstream

remote: Permission to mzaanen/test.git denied to arc.
fatal: unable to access '': The requested URL returned error: 403

It drives me up the wall, somewhere, I don't know where, "arc" is sticking around and I can't get rid of this name. Please assist, this has already cost me many hours...

PyCharm V3.4.1.

Kind regards,
Comment actions Permalink

For anyone who still stumbles upon this issue, you can fix it by revoking GitHub personal access token for your JetBrains product. You may find them in GitHub->Settings->Developer Settings -> Personal Access Tokens. I revoked all my tokens for both old and new account just in case. Then, on you next push attempt, a GitHub login window will pop up, where you login with your new account.

Also, if you are using macOS, you should try deleting your github credentials in osxkeychain. This can be done by simply going to keychain access app, searching github and deleting the ones with Intelij in name

Hope this helps someone.

Comment actions Permalink

> Also, if you are using macOS, you should try deleting your github credentials in osxkeychain

This is the solution, not revoking tokens. When pushing from the command line, no tokens from IntelliJ is used, as they are securely stored in the IntelliJ password safe and are not available for external processes

And the explanation is that git by default has its own credential helper installed, that saves credentials to the keychain. And if wrong credentials are there, git keeps using them without asking IDE or user for input.

Comment actions Permalink

Another thing that could cause the issue is git global configuration. You might have used the following command after initiating your git repository. 

$ git config --global <>

To fix the issue change user.mail of each repository to your JetBrain username, which is an email address. 

$ git config <>

 If you only have one Github  account, then you can add the --global option. 

$ git config --global <>


Please sign in to leave a comment.