Remote is already on Github, linked intelliJ project to the wrong Github account

I have two GitHub accounts. I linked the project that I would like to share to my repository to the wrong one. I have:

  • removed the token from the incorrect account via the settings in GitHub
  • removed the incorrect account from the intelliJ VCS settings.
  • deleted the vcs.xml file from the project path in intelliJ

However, whenever I try to re-setup the VCS through GitHub in IntelliJ, i receive the error: “failed to create GitHub repository, remote origin already exists.”

This is one of my first times using the site’s functionality, so any help is much appreciated.

Hey there @dan-walker-cs o/

How are you going? Hopefully well, but let’s see if we can’t address your question… :crossed_fingers:

Specifically regarding this message:

failed to create GitHub repository, remote origin already exists

…typically happens when you already have a local remote repository, with the name origin.

You may want to remove the the remote repository, like:

git remote rm origin

But before I continue on with what you could do, I’m curious to the action, or full command, that you’re running, which produces that message. Is the error following a command of git remote add origin? Or are you making a particular action within the IDE you mentioned?

Either way, it sounds like a redundant command, which is attempting to create a remote that already exists.

There’s an awesome e-book available, here:

https://git-scm.com/book/en/v2

…which I highly recommend, as you start to learn about using Git, alongside your IntelliJ IDE.

Let us know how you go, and if you have any followup questions!

1 Like