Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i make a non-bare git repository into a bare one? [duplicate]

Tags:

git

Possible Duplicate:
How to convert a git repository from normal to bare ?

I would like to make a repo into a bare repo so people can push to it with out big nasty warnings. I could delete it and clone it again... but perhaps there is a more elegant way?

like image 668
Arthur Ulfeldt Avatar asked May 27 '10 17:05

Arthur Ulfeldt


1 Answers

It's probably best to just delete and clone again. Example:

mv old_git_repo/ /tmp/
git clone --bare /tmp/old_git_repo/  new_git_repo/

You could also just remove the working files and promote .git/* to .. However, you'd also need to add bare = true and remove logallrefupdates = true in the new bare config's [core] section (formerly .git/config. You could make a script to do this automatically if you like.

Edit: You mentioned in a comment that this was cloned from svn, so a new clone will take a long time. But - don't clone from svn! Just clone from the new git repo, and it will be git -> git, which will be fast. Or, see my note above about just moving the files.

like image 109
Peter Avatar answered Sep 30 '22 17:09

Peter