Kevin Lawrence
Kevin Lawrence

Reputation: 748

How do I manage multiple GitHub accounts with IntelliJ/RubyMine/etc

I have a personal account and a work account on GitHub. Every time I switch from a personal project to a work project, RubyMine says that I don't have permission to this repository.

I go through the dance of logging in to the right account and push again. But then the same thing happens again the next time I switch projects.

How can I configure RubyMine (or IntelliJ/PyCharm/etc) to handle multiple accounts?

This has happened to me every couple of months for years now and my google-gu has always failed me. I finally figured it out and thought I'd share the good news with everyone.

Upvotes: 1

Views: 1216

Answers (2)

chmich
chmich

Reputation: 1176

On RubyMine > Preferences > Version Control > (GitLab | ..) you can manage your accounts, delete double accounts or add the access token

Upvotes: 0

Kevin Lawrence
Kevin Lawrence

Reputation: 748

The first time that you try to push to the wrong repository, RubyMine will pop a dialog saying that you don't have permission and ask you to sign in.

It will offer two options:

  1. Login… (this always hangs for me on the JetBrains website. Broken?)
  2. Generate token…

Make sure you are signed in to the correct GitHub account and choose Generate Token. RubyMine will take care of the rest.

Repeat the process for the other project (switching to the correct GitHub account first).

The next time, you switch projects, RubyMine will pop a dialog offering both accounts and will ask you to associate an account with this project.

You'll never have the problem again!

As I type this, it seems so simple that I wonder why I have had this problem for so many years. But I did.

Upvotes: 1

Related Questions