Skip to content

Instantly share code, notes, and snippets.

@temperatio
Created January 8, 2019 10:22
Show Gist options
  • Save temperatio/aed15e42db9674bbab169f4f37745f65 to your computer and use it in GitHub Desktop.
Save temperatio/aed15e42db9674bbab169f4f37745f65 to your computer and use it in GitHub Desktop.
#!/bin/bash
#############################################################
# Script para convertir un repositorio de git en compartido #
#############################################################
if [ "$(id -u)" != "0" ]; then
echo "Este script hay que ejecutarlo con permisos de root"
exit 1
fi
if [ "$#" -ne 1 ]; then
echo "Sólo puede haber un parametro"
exit 1
fi
FILE="$1/HEAD"
if [ -f $FILE ]; then
REPO=$1
echo "Convirtiendo el repositorio en compartido ($REPO)"
chgrp -R gitusers $REPO
chmod -R g+w $REPO
find $REPO -type d -exec chmod g+s '{}' +
cd $REPO
git config core.sharedRepository group
echo "$REPO convertido en repositorio compartido"
else
echo "$1 no parece un repositorio Git"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment