I had a GitHub repository which I decided to delete but continue to maintain only as a local repo on my hard drive. I am now left with the locally cloned repo which maintains all the history and that's fine. However, a number of configuration settings remain that point to the (now deleted) GitHub repo. E.g:
$ grep github .git/*
.git/config: url = https://github.com/foo/bar.git
.git/FETCH_HEAD:07c0bac92a829f3acb4b2f5c112de5f787f046e4 branch 'master' of https://github.com/foo/bar
What should I do to ensure that my local repo contains no dangling references and that I cannot push upstream from it anymore nor fetch into it? (how do we call such a repo that doesn't have a remote origin?) It is not clear to me which settings to delete / update and which values to use.
The git remote remove command removes a remote from a local repository. You can use the shorter git remote rm command too. The syntax for this command is: git remote rm <remote-url>. If you remove a remote accidentally, you will need to add it back manually using the git remote add command.
Go to working directory where you project folder (cloned folder) is placed. Now delete the folder. in windows just right click and do delete.
Issuing
git remote rm origin
will delete the config settings from .git/config
.
Then issue
rm .git/FETCH_HEAD
to get rid of the FETCH_HEAD
which still points to github.
However, as @gturri said even if those settings are present, your local copy is already "uncoupled" from the github repository. This is because you deleted the remote repository and every action like push/pull/fetch
would lead to an error therefore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With