git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Correct way of making existing remote repository "bare"

From
DSDirk Süsserott <newsletter@dirk.my1.cc>
Date
Jul 15, 2009, 14:12 UTC
Message-ID
<4A5DE3DA.1010004@dirk.my1.cc>
In-Reply-To
<h3khis$3tq$1@ger.gmane.org>
Am 15.07.2009 14:20 schrieb Graeme Geldenhuys:
Show 26 quoted lines
> Hi,
> 
> Yesterday I initialized a new repository on our server. I did some 
> coding locally, added the remote server (git remote add ....) and then 
> pushed my changes to the remote server.
> 
> But I noticed that my remote server is not a "bare" repository and git 
> complains when I push to it again. What is the correct way to make an 
> existing remote repository bare?
> 
> This is what I did and it worked, but not sure if this is the correct 
> way of doing it.
> 
> Steps I done:
> 
> * ssh to remote server
> * git clone --bare -l <path_to_repos> <new_dir>
> * renamed old repository directory
> * renamed new repository dir to what old repository used to be.
> 
> Like I said, this did the tick, but is this the correct way of doing it?
> 
> 
> Regards,
>   - Graeme -
> 

Sounds like that's the correct way. I sometimes faced the same problem and was lazy:

$ ssh to the remote && cd repo $ rm everything except for the .git directory (make sure everything is committed before doing this) $ mv .git/* . && rmdir .git # i.e.move the .git contents one level up $ edit config change 'core.bare=false' to 'core.bare=true' (or add a similar line)

done.

I think what you did is 'porcellain' while my solution is 'plumbing'. Any complaints?

     Dirk
Previous: Eric RaibleNext: Junio C Hamano
Message 6 of 7 in “Correct way of making existing remote repository "bare"”
  1. Graeme GeldenhuysJul 15, 2009
  2. Johannes SchindelinJul 15, 2009
  3. Dirk SüsserottJul 15, 2009
  4. Graeme GeldenhuysJul 15, 2009
  5. Eric RaibleJul 16, 2009
  6. Dirk SüsserottJul 15, 2009
  7. Junio C HamanoJul 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.