Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move git repositories from github to local server running gitolite

Tags:

git

gitolite

I would like to know the preferable way to move all my git repositories currently hosted on github to a new git server gitolite-based.

Just for knowing, the reason why I'm doing this switch is the adoption of Redmine to support our project management process.

like image 825
Rui Gonçalves Avatar asked Dec 08 '22 22:12

Rui Gonçalves


1 Answers

Add the new repo in gitolite-admin/conf/gitolite.conf

repo my-new-repo
    RW+            = your-user

Add, commit and push the changes into gitolite-admin

git add conf/gitolite.conf
git commit -m "Added my-new-repo"
git push origin

Clone your github repo and checkout all the branches present

git clone github.com:/USERNAME/YOUR_REPO.git
cd YOUR_REPO
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do     git branch --track ${branch##*/} $branch; done

Remove the github remote, and add your gitolite remote:

git remote rm origin
git remote add origin YOURSERVER:my-new-repo.git

Push all the refs onto the repo managed by gitolite:

git push --all origin

I verified the steps in a test repository of mine, and all the refs seem to have propagated into the new repo.

UPDATE: Like Seth pointed out, any other refs other than branches are not propagated to the new repo. I too feel Mirror would be a better option.

like image 96
Tuxdude Avatar answered Apr 27 '23 01:04

Tuxdude