Moving existing local GIT repository into a fresh gitolite setup

One of the tools I use is gitolite, a nice solution for hosting GIT repositories with privileges control and many more. Installation is trivial, just follow the tutorial instructions.
Let’s say you already have local repository and start to use gitolite on a remote server. This may happen when changing servers, git hosting provider etc. How to safely transfer your project? Firstly, you have to create new (usually bare) repository. In gitolite you just add to gitolite-admin/conf/gitolite.conf something similar:

Then go to your local working copy and type:

This will show you all remote repositories that you used to connect with. In my case there was only “origin”, and it was the exact one I wanted to replace. With following commands you remove existing repository:

and add a new one:

What will show more verbose version of “git remote” now?

That’s it. Now you can send your data to server:

Because it is very first “push” into an empty repo, you must explicitly point which remote and what branch you are sending data to. This will be remembered as default, so you don’t need to type it anymore. The same applies to the first “pull” or “fetch”:

21. October 2011 by resset
Categories: Software | Tags: , | 3 comments

Comments (3)

  1. Pingback: Setting up a gitolite server in Ubuntu | Marian Schedenig's Website

  2. Pingback: git | Pearltrees

  3. Worked a treat, thanks!

Leave a Reply

Required fields are marked *