Hello, friends. In this post, you will learn how to remove a Remote Git repository. The process is simple, but it is good to keep in mind to avoid surprises in the future.
Git is a decentralized version control system that allows you to add repositories locally or remotely. Deleting a repository locally is as simple as deleting the folder.
However, when we discuss a remote repository, things change a bit.
Generally, there is at least one remote repository in each repository called Origin, but there can be more.
Remove a Remote Git repository
First, create a remote in a local repository using this command
git remote add origin https://github.com/unixcop/repo.git
Here, we are adding our local repository to the remote.
origin refers to the repository to add, and the second parameter is the URL of the remote repository. Note that this will change in each case.
Then access the folder of your repository. For example:
And check the remote repositories that exist in the folder
git remote -v
origin https://github.com/unixcop/repo.git (fetch) origin https://github.com/unixcop/repo.git (push)
And to perform the removal. Just run:
git remote rm origin
You can also change the
remove so it will work anyway.
I also remind you that the method is safe since it will not be removed from the server but from the mirror copy locally.
Check the changes again.
git remote -v
If there is nothing to remove, no output will be shown on the screen.
Git is a marvel, but its many options make that we have to keep an eye on each of them. I hope you liked the post. It is oriented to newbies but also to more experienced users in git and development.