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).
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:
- Change the URL
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
- 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.
Last modified on 2021-10-05