Skip to content

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 my free coding handbooks!

THE VALLEY OF CODE

THE WEB DEVELOPER's MANUAL

You might be interested in those things I do:

  • Learn to code in THE VALLEY OF CODE, your your web development manual
  • Find a ton of Web Development projects to learn modern tech stacks in practice in THE VALLEY OF CODE PRO
  • I wrote 16 books for beginner software developers, DOWNLOAD THEM NOW
  • Every year I organize a hands-on cohort course coding BOOTCAMP to teach you how to build a complex, modern Web Application in practice (next edition February-March-April-May 2024)
  • Learn how to start a solopreneur business on the Internet with SOLO LAB (next edition in 2024)
  • Find me on X

Related posts that talk about git: