How to disconnect a local Git repository from remote master

Git

Git Problem Overview


How do I completely disconnect a local Git repository from all remote branches?

I cloned a Git repository from github.com, but then it was deleted and I don't want Git to report any changes needing to be "pushed up". I've tried googling this, but I think my terminology is wrong, and I'm not finding anything.

Can I simply delete the [remote "origin"] and [branch "master"] sections from my .git/config file or will that break my local repository?

Git Solutions


Solution 1 - Git

git remote rm origin should work.

Solution 2 - Git

This works:

To remove a remote: git remote remove origin

To add a remote: git remote add origin yourRemoteUrl & then git push -u origin master

Solution 3 - Git

If you remove the .git folder, it will disconnect your local repo from the remote.

rm -rf path/to/local_repo/.git

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCerinView Question on Stackoverflow
Solution 1 - Githelion3View Answer on Stackoverflow
Solution 2 - GitVonteiView Answer on Stackoverflow
Solution 3 - GitDanGoodrickView Answer on Stackoverflow