How to remove a Git remote
I had this need. I wanted to create an exact copy of an existing website, and put it in a subdomain, as an archive.
Now this site is under version control, and I wanted to retain the Git history but also deploy it to a new GitHub repo, so I could deploy it separately, now both sites could go on their own destiny.
The website is a Hugo site, so I just copied the website folder into a separate folder, and that was it, locally.
So I went into the copied site folder in the terminal, and I ran
git remote -v
this listed the existing GitHub repository as the “origin” remote.
I ran:
git remote rm origin
This removed the origin remote, so running git remote -v didn’t return anything any more.
Now since I use GitHub Desktop I just dragged the folder in that app, and I was able to create a new, different GitHub repository from there.
download all my books for free
- javascript handbook
- typescript handbook
- css handbook
- node.js handbook
- astro handbook
- html handbook
- next.js pages router handbook
- alpine.js handbook
- htmx handbook
- react handbook
- sql handbook
- git cheat sheet
- laravel handbook
- express handbook
- swift handbook
- go handbook
- php handbook
- python handbook
- cli handbook
- c handbook
subscribe to my newsletter to get them
Terms: by subscribing to the newsletter you agree the following terms and conditions and privacy policy. The aim of the newsletter is to keep you up to date about new tutorials, new book releases or courses organized by Flavio. If you wish to unsubscribe from the newsletter, you can click the unsubscribe link that's present at the bottom of each email, anytime. I will not communicate/spread/publish or otherwise give away your address. Your email address is the only personal information collected, and it's only collected for the primary purpose of keeping you informed through the newsletter. It's stored in a secure server based in the EU. You can contact Flavio by emailing flavio@flaviocopes.com. These terms and conditions are governed by the laws in force in Italy and you unconditionally submit to the jurisdiction of the courts of Italy.