Setting Up Users, Permissions and Groups for SSH Access to a Shared Git Repository

If you are having permission problems using git, such as

error: insufficient permission for adding an object to repository database ./objects

There are a couple thing you can do to remedy the situation, before moving to a full on git server like gitosis.

Create your users and add them to a group. Create (if you haven’t already) your git repo on the server and change permission and ownship and set the git config sharedRepository to true.

Here are all the commands, quick and dirty!

adduser sean
adduser jackson
groupadd developers
adduser sean developers
adduser jackson developers

mkdir -p /git/dev/app.git
cd /git/dev/app.git
git --bare init
vim description  #edit this file (mac os x complains otherwise)
chmod -R g+ws *
chgrp -R developers *
git repo-config core.sharedRepository true

Found from: http://mapopa.blogspot.com/2009/10/git-insufficient-permission-for-adding.html

Add Users to a Group on Ubuntu

To create a new user on Ubuntu (Heron8)

adduser johndoe

To create a new group

groupadd barleyfarmers

Add johndoe to the barleyfarmers group

adduser johndoe barleyfarmers

The adduser command, when you’re first adding the new user account, will prompt you for information pertaining to the account -name, phone, password, etc. If you want to change the password use the passwd command followed by the username for that account.

passwd johndoe