# committing to a checked out branch

5 messages from 2009-05-19 to 2009-05-19. Participants: Jeff Brown, Jay Soffian.
Thread: https://gitlist.dev/t/19410

## Jeff Brown, 2009-05-19 00:33

Subject: committing to a checked out branch
Message-ID: <bbd12f0f0905181733h6a9537d2hf4e6b7a1384fa32d@mail.gmail.com>
URL: https://gitlist.dev/e/bbd12f0f0905181733h6a9537d2hf4e6b7a1384fa32d%40mail.gmail.com

```
The workspace on my server is currently "checked out" so I get the big
warning message every time I push to there.  What is the best way to
cleanup that working area so I can push to it without the large
warning every time I commit.  I know I can set a config variable to
squelch the message but that isn't what I want to do.  I want to make
the workspace on the server _not_ be checked out.

Thanks for the help.



jb
-- 
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

```

## Jay Soffian, 2009-05-19 02:17

Subject: Re: committing to a checked out branch
Message-ID: <76718490905181917u1f41e06dq9cf527a1dac9bea5@mail.gmail.com>
URL: https://gitlist.dev/e/76718490905181917u1f41e06dq9cf527a1dac9bea5%40mail.gmail.com
In-Reply-To: <bbd12f0f0905181733h6a9537d2hf4e6b7a1384fa32d@mail.gmail.com>

```
On Mon, May 18, 2009 at 8:33 PM, Jeff Brown <jeff@jeffandbetsy.net> wrote:
> The workspace on my server is currently "checked out" so I get the big
> warning message every time I push to there.  What is the best way to
> cleanup that working area so I can push to it without the large
> warning every time I commit.  I know I can set a config variable to
> squelch the message but that isn't what I want to do.  I want to make
> the workspace on the server _not_ be checked out.
>
> Thanks for the help.

If you never want to checkout any branches in that repo on your
server, then what you want is a bare repository. The easiest way to
create it is as follows:

$ git clone --bare /path/to/repo /path/to/repo.git

Then you can remove /path/to/repo after verifying everything is sane.
Note the ".git" extension is a convention denoting the repository is
bare (vs "repo/.git", which implies a repository with a working copy).

j.

```

## Jeff Brown, 2009-05-19 15:09

Subject: Re: committing to a checked out branch
Message-ID: <bbd12f0f0905190809k3dc13c3ak170535a5c0eed9b9@mail.gmail.com>
URL: https://gitlist.dev/e/bbd12f0f0905190809k3dc13c3ak170535a5c0eed9b9%40mail.gmail.com
In-Reply-To: <76718490905181917u1f41e06dq9cf527a1dac9bea5@mail.gmail.com>

```
On Mon, May 18, 2009 at 9:17 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
> On Mon, May 18, 2009 at 8:33 PM, Jeff Brown <jeff@jeffandbetsy.net> wrote:
>> The workspace on my server is currently "checked out" so I get the big
>> warning message every time I push to there.  What is the best way to
>> cleanup that working area so I can push to it without the large
>> warning every time I commit.  I know I can set a config variable to
>> squelch the message but that isn't what I want to do.  I want to make
>> the workspace on the server _not_ be checked out.
>>
>> Thanks for the help.
>
> If you never want to checkout any branches in that repo on your
> server, then what you want is a bare repository. The easiest way to
> create it is as follows:
>
> $ git clone --bare /path/to/repo /path/to/repo.git
>
> Then you can remove /path/to/repo after verifying everything is sane.
> Note the ".git" extension is a convention denoting the repository is
> bare (vs "repo/.git", which implies a repository with a working copy).
>
> j.
>

Very good.  That appears to have worked nicely.  I appreciate the help.

When I create a new repo on my server I have been creating an empty
directory, then git init, then git add some file and commit.  I expect
that is the long/wrong way to initialize a repo, especially if I want
it to be bare.  What is the best approach to creating a cloneable bare
repo?



jb

-- 
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

```

## Jay Soffian, 2009-05-19 15:21

Subject: Re: committing to a checked out branch
Message-ID: <76718490905190821p1776905bn53610c0e8acd0113@mail.gmail.com>
URL: https://gitlist.dev/e/76718490905190821p1776905bn53610c0e8acd0113%40mail.gmail.com
In-Reply-To: <bbd12f0f0905190809k3dc13c3ak170535a5c0eed9b9@mail.gmail.com>

```
On Tue, May 19, 2009 at 11:09 AM, Jeff Brown <jeff@jeffandbetsy.net> wrote:
> When I create a new repo on my server I have been creating an empty
> directory, then git init, then git add some file and commit.  I expect
> that is the long/wrong way to initialize a repo, especially if I want
> it to be bare.  What is the best approach to creating a cloneable bare
> repo?

server$ mkdir /path/to/newrepo.git
server$ cd /path/to/newrepo.git && git init --bare
laptop$ git clone ssh://server/path/to/newrepo.git
laptop$ cd newrepo
laptop$ # add; commit; add; commit; ...
laptop$ git push origin master

(This may only work with recent versions of git as I believe earlier
versions used to complain about cloning an empty repository.)

j.

```

## Jeff Brown, 2009-05-19 17:01

Subject: Re: committing to a checked out branch
Message-ID: <bbd12f0f0905191001iad76a64id648780547b43b34@mail.gmail.com>
URL: https://gitlist.dev/e/bbd12f0f0905191001iad76a64id648780547b43b34%40mail.gmail.com
In-Reply-To: <76718490905190821p1776905bn53610c0e8acd0113@mail.gmail.com>

```
On Tue, May 19, 2009 at 10:21 AM, Jay Soffian <jaysoffian@gmail.com> wrote:
> On Tue, May 19, 2009 at 11:09 AM, Jeff Brown <jeff@jeffandbetsy.net> wrote:
>> When I create a new repo on my server I have been creating an empty
>> directory, then git init, then git add some file and commit.  I expect
>> that is the long/wrong way to initialize a repo, especially if I want
>> it to be bare.  What is the best approach to creating a cloneable bare
>> repo?
>
> server$ mkdir /path/to/newrepo.git
> server$ cd /path/to/newrepo.git && git init --bare
> laptop$ git clone ssh://server/path/to/newrepo.git
> laptop$ cd newrepo
> laptop$ # add; commit; add; commit; ...
> laptop$ git push origin master
>
> (This may only work with recent versions of git as I believe earlier
> versions used to complain about cloning an empty repository.)
>

git init --bare

That is the bit I needed.

Thanks again!



jb

-- 
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

```
