LKBEN11577: Howto remove a git remote without deleting any local data.


Symptom

You need to disconnect from the remote git repository but want to keep a local git.

Cause

You don't want to git pull and git push anymore.

Solution

To detach from a remote git repository, you can use the following commands:

First we show the remote so we can test afterwards:

git remote -v
git remote remove origin

In case your remote is not named "origin", you should use your <remote_name> which you can check in your config file or with the first command.

After the remove command, you can check with the first command if everything worked fine.

Your local git copy will stay, no data should be lost.

You can also edit the ".git/config" file, but it is safer to use a command.

Have fun.

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.

Latest update: 10.06.2022 | Comment: