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

Answered
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 – jaja.py
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 jaja.py
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 'https://github.com/mzaanen/test.git/': 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.

Thanks,
Kind regards,
Maarten
2 comments

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.

4

> 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.

0

Please sign in to leave a comment.