gitosis: how to add new repository
20th February 2009
I assume that you already have your gitosis-admin repository working (this is described elsewhere).
- cd gitosis-admin && git pull – enter your gitosis administrative repository and ensure it is up-to-date
- $EDITOR gitosis.conf
- 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 - 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
- git commit -a -m ‘new repository: newreponame’; git push;
- 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.
- git commit -m ‘initial commit’
- git remote add origin ssh://gitosis@yourGitosisServerName/newreponame.git
- git push ––all
- 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/masterWitlhout these lines, you won’t be able to git pull.
April 17th, 2009 at 7:00
Thanks, this was useful
October 13th, 2009 at 17:35
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!
October 13th, 2009 at 23:18
You are welcome!
I’m using this as a reference myself
January 14th, 2010 at 0:27
[...] gitosis: how to add new repository [...]
January 22nd, 2010 at 0:02
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
January 25th, 2010 at 10:13
Thank you, I’ve updated the text.