When creating a git repository that will be on the server, can I convert it to a bare repository?

10,013

Solution 1

According to the FAQ, conversion from non-bare to bare can be done in two ways. The best one:

$ git clone --bare -l repo repo.git
$ rm -rf repo

To create a bare repository from scratch:

$ mkdir repo.git
$ cd repo.git
$ git --bare init

Solution 2

Just move the .git folder away from the working copy.

mv /var/git/repo/repo/.git /var/git/repos/repo.git

You might want to follow that up with a

git config --bool core.bare true

in that repository, just in case git complains about something not being right.

Solution 3

git clone --bare repo

This will give you a new bare version of repo named repo.git. Easy, no?

Share:
10,013
mrblah
Author by

mrblah

test testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest testtest test asdf asdf

Updated on June 15, 2022

Comments

  • mrblah
    mrblah about 2 years

    I already created a repository. Can I make it a bare type or shall I start over?