Migrate repository from github to local filesystem?

I have a git repository on github.

I would like to migrate the master version of the repository to a local filesystem, and clone from this local filesystem copy.

  • git difftool, open all diff files immediately, not in serial
  • How to add ssh key path to a git command terminal
  • pushing to git remote branch
  • how to re-parent in Git
  • How to git ignore folders that begin with # sign
  • Unknown SSL protocol error in connection
  • How do I do so?

  • How do I manage users on Bitbucket
  • String comparison not working in PowerShell function - what am I doing wrong?
  • Use git-svn with an existing repo lacking .git/svn/
  • Isn't it strange to have branches for totally unrelated code with master?
  • GIT: Appending a patch made after a few commits
  • git “Your branch and 'origin/master' have diverged” after fresh clone of remote repo
  • 2 Solutions collect form web for “Migrate repository from github to local filesystem?”

    First, create your new repository by cloning your github repository:

    git clone --bare git@github.com:<User Name>/<Project Name>.git

    If you want to delete your github repository, go to https://github.com/<User Name>/<Project Name>/edit. At the bottom of the page, there is link to delete the repository.

    Then setup your new repository to be shared:


    Finally, on all other clones of the github repository, change the url of origin:

    git remote set-url origin <new url>

    There is no “master” repository when using Git, so all you need to do is git clone the one from Github, and then clone from your local repository.

    Of course you can’t instruct Github to pull from your local repository, so you will still need to use git push to push any changes to Github. However, doing so doesn’t make the Github repository any more authoritative than your local one.

    When you git clone a repository, Git sets up the “origin” remote (see git remote) to point to the repository you just cloned from. So, if you have a github repository G, and clone to a local repository A, then clone A to another repository B, then B’s “origin” will point to A, not to G.

    You can always change what the “origin” points to using the git remote command.

    Git Baby is a git and github fan, let's start git clone.