# Make a non-bare repo bare.

13 messages from 2009-07-15 to 2009-07-17. Participants: Tim Visher, Paolo Bonzini, Jeff King, Junio C Hamano, Graeme Geldenhuys, Mike Ralphson, Sitaram Chamarty.
Thread: https://gitlist.dev/t/20124

## Tim Visher, 2009-07-15 21:43

Subject: Make a non-bare repo bare.
Message-ID: <c115fd3c0907151443h49aaac60r3462c69f55ed2d9f@mail.gmail.com>
URL: https://gitlist.dev/e/c115fd3c0907151443h49aaac60r3462c69f55ed2d9f%40mail.gmail.com

```
Hello Everyone,

I recently had occasion to make a previously non-bare repo bare.  Is
there any way to do this?  It will not allow me to delete a branch
that I'm on so I wasn't sure how to proceed.

Thanks!

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

```

## Paolo Bonzini, 2009-07-15 21:48

Subject: Re: Make a non-bare repo bare.
Message-ID: <4A5E4EBA.4050708@gnu.org>
URL: https://gitlist.dev/e/4A5E4EBA.4050708%40gnu.org
In-Reply-To: <c115fd3c0907151443h49aaac60r3462c69f55ed2d9f@mail.gmail.com>

```
On 07/15/2009 11:43 PM, Tim Visher wrote:
> Hello Everyone,
>
> I recently had occasion to make a previously non-bare repo bare.  Is
> there any way to do this?  It will not allow me to delete a branch
> that I'm on so I wasn't sure how to proceed.

Just do "mv repo/.git repo.git; rm -rf repo" (with care!).

Paolo

```

## Tim Visher, 2009-07-16 00:54

Subject: Re: Make a non-bare repo bare.
Message-ID: <c115fd3c0907151754o55acec54ocdcdebe177b3c9c4@mail.gmail.com>
URL: https://gitlist.dev/e/c115fd3c0907151754o55acec54ocdcdebe177b3c9c4%40mail.gmail.com
In-Reply-To: <4A5E4EBA.4050708@gnu.org>

```
On Wed, Jul 15, 2009 at 5:48 PM, Paolo Bonzini<bonzini@gnu.org> wrote:
> On 07/15/2009 11:43 PM, Tim Visher wrote:
>> I recently had occasion to make a previously non-bare repo bare.  Is
>> there any way to do this?  It will not allow me to delete a branch
>> that I'm on so I wasn't sure how to proceed.
>
> Just do "mv repo/.git repo.git; rm -rf repo" (with care!).

Thanks, Paolo.

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

```

## Jeff King, 2009-07-16 02:19

Subject: Re: Make a non-bare repo bare.
Message-ID: <20090716021921.GA29139@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090716021921.GA29139%40coredump.intra.peff.net
In-Reply-To: <4A5E4EBA.4050708@gnu.org>

```
On Wed, Jul 15, 2009 at 11:48:42PM +0200, Paolo Bonzini wrote:

> On 07/15/2009 11:43 PM, Tim Visher wrote:
> >I recently had occasion to make a previously non-bare repo bare.  Is
> >there any way to do this?  It will not allow me to delete a branch
> >that I'm on so I wasn't sure how to proceed.
> 
> Just do "mv repo/.git repo.git; rm -rf repo" (with care!).

That used to work, but these days there is a "core.bare" config variable
so that git doesn't have to guess whether you are in a bare repo. So you
should also do:

  $ git config core.bare true

in the resulting repo (or just before, since your "mv" is obviously not
a git command that would care).

-Peff

```

## Junio C Hamano, 2009-07-16 02:33

Subject: Re: Make a non-bare repo bare.
Message-ID: <7vbpnlbbln.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbpnlbbln.fsf%40alter.siamese.dyndns.org
In-Reply-To: <c115fd3c0907151443h49aaac60r3462c69f55ed2d9f@mail.gmail.com>

```
Tim Visher <tim.visher@gmail.com> writes:

> Hello Everyone,
>
> I recently had occasion to make a previously non-bare repo bare.  Is
> there any way to do this?  It will not allow me to delete a branch
> that I'm on so I wasn't sure how to proceed.

Funny.

    http://article.gmane.org/gmane.comp.version-control.git/123303

It is posed as a question but describes the correct (and officially
supported) procedure.

```

## Graeme Geldenhuys, 2009-07-16 08:51

Subject: Re: Make a non-bare repo bare.
Message-ID: <h3mpls$9dt$1@ger.gmane.org>
URL: https://gitlist.dev/e/h3mpls%249dt%241%40ger.gmane.org
In-Reply-To: <7vbpnlbbln.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:
> 
> Funny.
> 
>     http://article.gmane.org/gmane.comp.version-control.git/123303
> 
> It is posed as a question but describes the correct (and officially
> supported) procedure.


Now it deserves to be in some Git FAQ. It seems the issue is more common 
than I thought. :-)


Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

```

## Mike Ralphson, 2009-07-16 08:55

Subject: Re: Make a non-bare repo bare.
Message-ID: <e2b179460907160155g7c84b083u8a1dd6ba193f4531@mail.gmail.com>
URL: https://gitlist.dev/e/e2b179460907160155g7c84b083u8a1dd6ba193f4531%40mail.gmail.com
In-Reply-To: <h3mpls$9dt$1@ger.gmane.org>

```
2009/7/16 Graeme Geldenhuys <graemeg@gmail.com>:
> Junio C Hamano wrote:
>>
>> Funny.
>>
>>    http://article.gmane.org/gmane.comp.version-control.git/123303
>>
>> It is posed as a question but describes the correct (and officially
>> supported) procedure.
>
>
> Now it deserves to be in some Git FAQ. It seems the issue is more common
> than I thought. :-)

It already is

http://git.or.cz/gitwiki/GitFaq#HowdoImakeexistingnon-barerepositorybare.3F

unless that's new?

```

## Sitaram Chamarty, 2009-07-16 11:39

Subject: Re: Make a non-bare repo bare.
Message-ID: <2e24e5b90907160439i29171e9fka3baf6bf871a6011@mail.gmail.com>
URL: https://gitlist.dev/e/2e24e5b90907160439i29171e9fka3baf6bf871a6011%40mail.gmail.com
In-Reply-To: <7vbpnlbbln.fsf@alter.siamese.dyndns.org>

```
On Thu, Jul 16, 2009 at 8:03 AM, Junio C Hamano<gitster@pobox.com> wrote:
> Tim Visher <tim.visher@gmail.com> writes:
>
>> Hello Everyone,
>>
>> I recently had occasion to make a previously non-bare repo bare.  Is
>> there any way to do this?  It will not allow me to delete a branch
>> that I'm on so I wasn't sure how to proceed.
>
> Funny.
>
>    http://article.gmane.org/gmane.comp.version-control.git/123303
>
> It is posed as a question but describes the correct (and officially
> supported) procedure.

The linked procedure uses git clone --bare.  It is my belief (and
please correct me if I'm wrong) that only a git clone --mirror
actually does what you want here -- a mere "bare" clone would lose
your remotes and their tracking branches would it not?

If I'm wrong please correct me...

```

## Tim Visher, 2009-07-16 11:47

Subject: Re: Make a non-bare repo bare.
Message-ID: <c115fd3c0907160447m3be44bcci46aa9d812884a8f6@mail.gmail.com>
URL: https://gitlist.dev/e/c115fd3c0907160447m3be44bcci46aa9d812884a8f6%40mail.gmail.com
In-Reply-To: <2e24e5b90907160439i29171e9fka3baf6bf871a6011@mail.gmail.com>

```
On Thu, Jul 16, 2009 at 8:03 AM, Junio C Hamano<gitster@pobox.com> wrote:
> Tim Visher <tim.visher@gmail.com> writes:
>
>> Hello Everyone,
>>
>> I recently had occasion to make a previously non-bare repo bare.  Is
>> there any way to do this?  It will not allow me to delete a branch
>> that I'm on so I wasn't sure how to proceed.
>
> Funny.
>
>    http://article.gmane.org/gmane.comp.version-control.git/123303
>
> It is posed as a question but describes the correct (and officially
> supported) procedure.

Thanks.  That's what I was looking for.  I wish I didn't have to
actually clone the repo anew but if that's how it is, oh well. :)

That wiki response seems to contradict what Junio said

On Thu, Jul 16, 2009 at 7:39 AM, Sitaram Chamarty<sitaramc@gmail.com> wrote:
> The linked procedure uses git clone --bare.  It is my belief (and
> please correct me if I'm wrong) that only a git clone --mirror
> actually does what you want here -- a mere "bare" clone would lose
> your remotes and their tracking branches would it not?
>
> If I'm wrong please correct me...

The linked wiki article seems to contradict what Junio said.  I guess
I'd go with Junio being somewhat authoritative on normative
prodecudures in the git world. /me shrugs.

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

```

## Junio C Hamano, 2009-07-16 20:47

Subject: Re: Make a non-bare repo bare.
Message-ID: <7vd4808iey.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd4808iey.fsf%40alter.siamese.dyndns.org
In-Reply-To: <e2b179460907160155g7c84b083u8a1dd6ba193f4531@mail.gmail.com>

```
Mike Ralphson <mike.ralphson@gmail.com> writes:

> 2009/7/16 Graeme Geldenhuys <graemeg@gmail.com>:
>> Junio C Hamano wrote:
>>>
>>> Funny.
>>>
>>>    http://article.gmane.org/gmane.comp.version-control.git/123303
>>>
>>> It is posed as a question but describes the correct (and officially
>>> supported) procedure.
>>
>>
>> Now it deserves to be in some Git FAQ. It seems the issue is more common
>> than I thought. :-)
>
> It already is
>
> http://git.or.cz/gitwiki/GitFaq#HowdoImakeexistingnon-barerepositorybare.3F
>
> unless that's new?

Somebody needs to promise to keep that entry up-to-date, or we should
rewrite it so that we do not expose such an implementation detail.

Even today core.bare is not the only difference between a repository with
a work tree and a bare one.  We also set core.logallrefupdates these days
for a repository with a work tree, so the procedure described there is
already stale.  And this kind of implementation details are bound to
change.

Asking git what to do is the only reliable "cut-and-paste-ready" recipe.

```

## Junio C Hamano, 2009-07-16 20:51

Subject: Re: Make a non-bare repo bare.
Message-ID: <7v8wio8i73.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v8wio8i73.fsf%40alter.siamese.dyndns.org
In-Reply-To: <2e24e5b90907160439i29171e9fka3baf6bf871a6011@mail.gmail.com>

```
Sitaram Chamarty <sitaramc@gmail.com> writes:

> On Thu, Jul 16, 2009 at 8:03 AM, Junio C Hamano<gitster@pobox.com> wrote:
>> Tim Visher <tim.visher@gmail.com> writes:
>>
>>> Hello Everyone,
>>>
>>> I recently had occasion to make a previously non-bare repo bare.  Is
>>> there any way to do this?  It will not allow me to delete a branch
>>> that I'm on so I wasn't sure how to proceed.
>>
>> Funny.
>>
>>    http://article.gmane.org/gmane.comp.version-control.git/123303
>>
>> It is posed as a question but describes the correct (and officially
>> supported) procedure.
>
> The linked procedure uses git clone --bare.  It is my belief (and
> please correct me if I'm wrong) that only a git clone --mirror
> actually does what you want here -- a mere "bare" clone would lose
> your remotes and their tracking branches would it not?

Depends on "what you want here".

I assumed that the request was to set up the most typical use of a bare
repository, that is to prepare a distribution point, separate from your
primary working repository with a work tree, from which you push your
updates into this new bare repository.

And in such a distribution point, you do not need nor want remotes.  The
point of remote tracking branches is to let you peek what others are doing
and merge with them, and that is done while you advance your history in
your primary working area with the work tree.  It does not happen in your
distribution point.

```

## Sitaram Chamarty, 2009-07-17 01:20

Subject: Re: Make a non-bare repo bare.
Message-ID: <2e24e5b90907161820o5ee24491j8744a8652e7dec26@mail.gmail.com>
URL: https://gitlist.dev/e/2e24e5b90907161820o5ee24491j8744a8652e7dec26%40mail.gmail.com
In-Reply-To: <7v8wio8i73.fsf@alter.siamese.dyndns.org>

```
On Fri, Jul 17, 2009 at 2:21 AM, Junio C Hamano<gitster@pobox.com> wrote:
> Sitaram Chamarty <sitaramc@gmail.com> writes:

>> The linked procedure uses git clone --bare.  It is my belief (and
>> please correct me if I'm wrong) that only a git clone --mirror
>> actually does what you want here -- a mere "bare" clone would lose
>> your remotes and their tracking branches would it not?
>
> Depends on "what you want here".
>
> I assumed that the request was to set up the most typical use of a bare
> repository, that is to prepare a distribution point, separate from your
> primary working repository with a work tree, from which you push your
> updates into this new bare repository.
>
> And in such a distribution point, you do not need nor want remotes.  The
> point of remote tracking branches is to let you peek what others are doing
> and merge with them, and that is done while you advance your history in
> your primary working area with the work tree.  It does not happen in your
> distribution point.

I agree, bares dont have remotes, normally.

I was speaking purely from a technical point of view.  Contrast, if
you will, with the other method seen in the thread and elsewhere (the
mv repo/.git repo.git, rm -rf repo, git config core.bare in repo.git
stuff), which does preserve all this.

Anyway, you confirmed my _understanding_ of clone bare versus clone
mirror, which is what I was looking for.  Thanks!

Sitaram

```

## Sitaram Chamarty, 2009-07-17 03:59

Subject: Re: Make a non-bare repo bare.
Message-ID: <2e24e5b90907162059u5e3dfca1x16cd57b0a10a7204@mail.gmail.com>
URL: https://gitlist.dev/e/2e24e5b90907162059u5e3dfca1x16cd57b0a10a7204%40mail.gmail.com
In-Reply-To: <7vd4808iey.fsf@alter.siamese.dyndns.org>

```
On Fri, Jul 17, 2009 at 2:17 AM, Junio C Hamano<gitster@pobox.com> wrote:
> Mike Ralphson <mike.ralphson@gmail.com> writes:

>> http://git.or.cz/gitwiki/GitFaq#HowdoImakeexistingnon-barerepositorybare.3F

> Somebody needs to promise to keep that entry up-to-date, or we should
> rewrite it so that we do not expose such an implementation detail.
>
> Even today core.bare is not the only difference between a repository with
> a work tree and a bare one.  We also set core.logallrefupdates these days
> for a repository with a work tree, so the procedure described there is
> already stale.  And this kind of implementation details are bound to
> change.

I wonder why core.logAllRefUpdates is not the default for bare repos.
I have taken to making that the _global_ default on any git/gitosis
server I install, so all my bare repos have it turned on.

My reason is that I do want to allow "push -f" (it _is_ sometimes
needed), but I also want to protect against such push happening in
error, and the reflog has always seemed like a good safety net to run
to when that happens.

Other than space (due to garbage collection delay until reflog expire)
what are the downsides?  Could someone enlighten me if I'm doing
something stupid here?

Thanks,

Sitaram

```
