Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unlinking a locally cloned repository from its GitHub origin

Tags:

git

github

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.

like image 510
Marcus Junius Brutus Avatar asked May 21 '14 16:05

Marcus Junius Brutus


People also ask

How do I remove remote origin from my local repository?

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.

How do I remove a cloned computer repository?

Go to working directory where you project folder (cloned folder) is placed. Now delete the folder. in windows just right click and do delete.


1 Answers

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.

like image 80
hek2mgl Avatar answered Sep 22 '22 15:09

hek2mgl