Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

  • Exits

  • Categories

  • Archives

  • Visitors’ track

    Locations of visitors to this page
  • Tags list

gitosis: how to add new repository

20th February 2009

I assume that you already have your gitosis-admin repository working (this is described elsewhere).

  1. cd gitosis-admin && git pull – enter your gitosis administrative repository and ensure it is up-to-date
  2. $EDITOR gitosis.conf
  3. add [group newreponame] section (newreponame is the name of your new repository being added); add yourself with members = yourlogin@yourhost line; also add writable = newreponame line:

    [group newreponame]
    members = yourlogin@yourhost
    writable = newreponame

  4. based on my assumption of a correctly setup gitosis-admin repository, you should already have the appropriate public key in the keydir directory, but if not – copy your user’s ssh public key to keydir in the form of yourlogin@yourhostname.pub, then do git add keydir/yourlogin@yourhostname.pub
  5. git commit -a -m ‘new repository: newreponame’; git push;
  6. now that you have the new repo permissions configured, let’s actually create it. Navigate to the directory holding the files of your project (e.g. cd ~/newreponame), and do git init; git add . – this initializes empty git repository, and then adds all the files to it.
  7. git commit -m ‘initial commit’
  8. git remote add origin ssh://gitosis@yourGitosisServerName/newreponame.git
  9. git push ––all
  10. final thing: git config ––add branch.master.remote origin && git config ––add branch.master.merge refs/heads/master; alternatively, cd .git && $EDITOR config, and then add these lines:

    [branch "master"]
    remote = origin
    merge = refs/heads/master

    Witlhout these lines, you won’t be able to git pull.

  • Share/Bookmark

6 Responses to “gitosis: how to add new repository”

  1. hauptmech Says:

    Thanks, this was useful

  2. John E Says:

    Thanks!! I love gitosis but always forget the details. The previous guides I use always seem to leave one step out or another, added to my bookmarks!

  3. Bogdan Says:

    You are welcome!

    I’m using this as a reference myself :)

  4. Synesthesia Says:

    [...] gitosis: how to add new repository [...]

  5. BigBaaadBob Says:

    Rather than directly edit the config file, you can (and maybe should) use:
    $ git config --add branch.master.remote origin
    $ git config --add branch.master.merge refs/heads/master

  6. Bogdan Says:

    Thank you, I’ve updated the text.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>