How to mirror a git repository


Sometimes you have the need to move a repository from one server or provider to another. This is what I´m going to do. Which is simple.


On your terminal

  1. First we create a bare clone of our origin repository.
git clone --bare
  1. Create a repository in the destination server or provider and once done copy the URL.

  2. Le'ts move to our cloned repository and push to the new destination.

cd old-repository.git
git push --mirror
  1. Finally let's delete the old-repository folder from our computer.
cd ..
rm -Rf old-repository


Now we have migrated or repository to a new provi er

Victor Yoalli

This is me.