Script to create a shared git project

By ctherouxNo Comments

This script creates a git project to be shared among the users of the Unix group $GIT_GROUP. Every git project will be created into the directory $REPOSITORIES_BASE_DIR.

#!/bin/bash

# Base directory where the shared git project are.
REPOSITORIES_BASE_DIR="/home/git"
# Group in which the user's of the repositories must be a member of
GIT_GROUP=git

if [ $# -ne 1 ]; then
        echo 'Usage:' `basename $0` 'project-name'
        exit 1
fi

PROJECT_NAME=$1

cd "$REPOSITORIES_BASE_DIR"
git init --shared --bare "$PROJECT_NAME"
cd ..
find git/$PROJECT_NAME -type d | xargs setfacl -R -m d:g:$GIT_GROUP:rwX
sudo setfacl -R -m g:$GIT_GROUP:rwX git/$PROJECT_NAME
GIT, Linux, Ubuntu, Unix

Leave your Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Blue Taste Theme created by Jabox