You are here


Duplicating a git repository to another repository - Bitbucket

Duplicating a git repository to another repository - Bitbucket
I always used SVN for managing my projects, that was the case till last year. Though moved to GIT too few years back, I did not completely move to GIT. The main reason was the comfort level. Of course GIT offer plenty of good features but SVN was also not bad, and most importantly I was the only developer on those projects.

Since last year our team has grown and we now use Bitbucket only for managing our code on git repositories. At Sparxsys we offer Drupal development at really competitive prices and our main USP is to deliver fast. Some of the projects have common functionality so we re-use the code of other projects. This may not be true for big complex projects but if we get a requirement for a relatively simple site with standard dynamic features for managing the content, forums, blogs, news, slideshows then we prefer to re-use the code.

For the past 1 year I was mostly involved in managing clients, sales, branding and non-technical activities but since last few weeks I have decided to get involved more deeply in the projects. So my role is now more of developer where I actually build websites, write modules and do lot of designing using Omega4 theme in SASS.

Here I am sharing very simple instructions to duplicate/mirror a git repository.

First create a bare clone of the old GIT repository on your local

git clone --bare

# Make a bare clone of the repository

You may want to do this in the folder other than your DocumentRoot that contains the folders of your other projects. Just to avoid confusion.

Now move into the directory


Push the code into the new repository

Of course you should create this empty repository before running this command.

git push --mirror

# Mirror-push to the new repository

Finally you may want to delete the old directory

cd ..
rm -rf OLD-PROJECT.git

# Remove our temporary local repository

And it is done. Easy no?

Subscribe to RSS - bare