Tutorial: mirror a local git repository

Mirror a local git repository with all commit information to a new repository:

  1. Create a bare clone of the repository.

    git clone --bare https://github.com/user/old-repository.git
  2. Mirror-push to the new repository.

    cd old-repository.git
    git push --mirror https://github.com/exampleuser/new-repository.git
    
  3. Remove your old bare clone

    cd ..
    rm -rf old-repository.git