You are here: Foswiki>Main Web>Gitosis (13 Jul 2018, OliverBock)Edit Attach


Clone an existing repository

You can clone any given repository like this (here: project niceproject):

git clone

Create a new repository

  • Ask an administrator to prepare your new repository (and your user account if necessary): e.g. bestprojectever
  • Initialize your repository locally
    • Create your local repository (if you haven't done so already)
      mkdir bestprojectever
      cd bestprojectever
      git init
    • Add the new remote repository (the one you asked for, here bestprojectever with alias origin)
      git remote add origin
    • Commit your initial revision locally
      # do some work
      git add <file1> <file2>
      git commit -m "Initial import"
    • Push your initial revision into the remote repository (creating the master branch)
      git push --all


All administrative work is done via the gitosis-admin git repository

  • In order to change the configuration you have to checkout the admin repository (neat!)
    git clone
  • Make your changes and push them back
  • You have to be an administrator to do this obviously wink
  • More features can be found in the attached example configuration

Prepare a new repository

  • Add new group (if desired) and assign initial users (public key basenames) as well as the desired repository name:
    [group bestprojectever]
    members = bob alice
    writable = bestprojectever
    • Please keep in mind to use a suitable path-prefix for writable
      • Public repositories: public/user/repo-name (write access: only user as member, still readable via git-daemon)
      • Shared repositories: shared/repo-name (write access: may have more than one member, still readable via git-daemon)
    • You also might want to add repository-specific settings (use a [repo path-prefix/repo-name] section)
      • daemon = [yes|no]
      • gitweb = [yes|no]
        • description =
        • owner =
  • Commit and push the changes to enable the new repository
    • The following warning is normal and can be ignored because the repository has to be initialized first (receive its initial commit) before the settings can take effect:
      Cannot find 'repo-name' in '/srv/gitosis/repositories'
  • Important: gitosis does not set receive.denynonfastforwards for shared repositories! It's strongly recommended you set it manually!
    • Log in on
    • cd to the repository concerned (base path: /srv/gitosis/repositories)
    • Add the setting mentioned above:
      git config --bool receive.denynonfastforwards true

Add a new user

  • Let the user create a fresh private/public ssh key pair (using ssh-keygen)
  • Rename the keyfile if required (the new username must match the key's filename without the .pub extension!)
  • Copy the public key ( into the keydir of your local gitosis-admin working tree and git add it
  • Edit gitosis.conf in your local gitosis-admin working tree
    • Add user (alice) to desired group(s) like this:
      [group bestprojectever]
      members = bob alice
      writable = bestprojectever
  • Commit and push the changes to enable the new user account

Add a new administrator

  • Add the new administrator's username to the [group gitosis-admin] in gitosis.conf (in your local gitosis-admin working tree)
  • Commit and push the changes to enable the new admin account

I Attachment Action Size Date Who Comment
example.confconf example.conf manage 1 K 21 Oct 2008 - 15:57 UnknownUser Example configuration (see what's possible)
Topic revision: r22 - 13 Jul 2018, OliverBock
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback