The easiest way to Move (export, then import) a git repository

The easiest way to “move a git repository” is to clone the repository:

git clone

Edit the file foo/.git/config.  Remove the following:

[remote "origin"] url = fetch = +refs/heads/*:refs/remotes/origin/*

Change “back a directory”  ../

Import the repository:

git remote add origin git push -u origin master

This has the advantage of retaining the commit history from the previous repository.

Author | Miles Davenport

Career programmer, who designs, assembles, fixes, and supports customers, software and systems.