Víctor Yoalli

How to mirror a git repository

Duplicating a git repository

Introduction

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.

Instructions

On your terminal

  1. First we create a bare clone of our origin repository.
bash
git clone --bare https://gitoriginalprovider.com/pathto/old-repository.git
  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.
bash
cd old-repository.git
git push --mirror git@github.com:victoryoalli/new-repository.git
  1. Finally let's delete the old-repository folder from our computer.
bash
cd ..
rm -Rf old-repository

Conclusion

Now we have migrated or repository to a new provi er

ESCRITOS DE VÍCTOR