How to Solve the Problem of "Remote Origin Already Exists"

Hongtao Hao / 2020-05-25


Here is my situation: I want to use another GitHub account. I need to transfer a repo from my old account to the new one. Maybe there is an easy way to transfer, but it is beyond my ability now (I guess it’s complicated so I didn’t even bother searching for an answer).

So I git clone the repo from my old account and tried to push it to my new account. Then, a error occurred:

fatal: remote origin already exists.

There are two ways to solve this problem:

  1. Change the URL

Here is where I found the answer. Many thanks to kahowell .

Simply use:

git remote set-url origin https://github.com/new.url.here

However, if you just want to remove the remote (and add a new one later), you can use the following line of code to remove remote:

git remote rm origin 
  1. Creating a new folder

Just create a new folder, and then drag all the files from the old folder into the new folder. The original git remote will be automatically erased.

Done.

Last modified on 2021-10-05