gitgithub

Unlinking a locally cloned repository from its GitHub origin


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.


Solution

  • 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.