How to remove a Remote Git

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

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:

cd repo/sample/

And check the remote repositories that exist in the folder

git remote -v

Sample output:

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 rm for 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.

Conclusion

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.

More about GIT

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook