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:
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 email@example.com, then do git add firstname.lastname@example.org
- git commit -am ‘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. If you have no files – you can skip the ‘git add .’ command, as it will do nothing for you.
- git commit -m ‘initial commit’. If you had no files added to the commit, git will complain that it cannot create an empty commit. In this case use the command git commit ––allow-empty -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:
remote = origin
merge = refs/heads/master
Without these lines, you won’t be able to git pull.