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

contrib/git-normal-to-bare.sh

From
ZHZenaan Harkness <zen@freedbms.net>
Date
May 27, 2013, 04:54 UTC
Message-ID
<CAOsGNST8X+crMQz1ynJQxctCMUnBw3T3K5HiMH8B_GFP63yX1w@mail.gmail.com>

I needed this quite a bit in the last few days, basic script but serves my need. I think it would be useful for other beginners if in $git/contrib/ source dir.

Just a start to a basic script. Needs more tests etc, but it's enough to get newbies (like me) off to a reasonable start. Handles multiple input dirs.

PLEASE CC me, as I am not subscribed.
(some SMTP server rejected attachment, so pasting below instead)

Thanks, Zenaan

#!/bin/bash

# Change one or more normal repos into bare repos: # See also https://git.wiki.kernel.org/index.php/GitFaq#How_do_I_make_existing_non-bare_repository_bare.3F

for i in "$@"; do
   echo; echo "----------------------"
   echo Processing $i
   repo="$i"
   repo="`basename $i`"
   tmp_repo="${repo}.git"
   # Insert here: may be exit if any spaces in repo fqn
   # Insert here: check for non-existent repo/.git dir
   # Insert here: check that we are not inside the repo
   # Insert here: add exit/do-nothing if fail to mv dirs etc
   mv $repo/.git $tmp_repo
   git --git-dir=$tmp_repo config core.bare true
   mv $repo ${repo}.bak
   mv $tmp_repo $repo
done
Next: Junio C Hamano
Message 1 of 2 in “contrib/git-normal-to-bare.sh”
  1. Zenaan HarknessMay 27, 2013
  2. Junio C HamanoMay 28, 2013

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.