aboutsummaryrefslogtreecommitdiff
path: root/make_repo.sh
blob: 98be45f3129317484e218efeaf25b817005129f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

GITROOT="/home/git/pub_repo"

if [ $USER != $(stat -c %U  ${GITROOT}) ] && [ $USER != "root" ] ; then
  echo "Sorry you cannot write in ${GITROOT}."
  echo "You must be the $(stat -c %U ${GITROOT}) user or the root user."
  exit
fi

if [ "$1" ]; then
  pushd ${GITROOT} > /dev/null
  mkdir -p $1
  chown -R neodarz:neodarz $1
  pushd $1 > /dev/null
  git init --bare --share=group
  popd > /dev/null
  chown -R git:git $1
else
  echo "You must specify a repo name like:"
  echo "$0 myproject.git"
fi