]> Raphaƫl G. Git Repositories - binary/blob - git-new
Import binaries
[binary] / git-new
1 #! /bin/sh
2
3 # Set git root
4 GITROOT='/var/www/git'
5
6 # make sure we have repository to create
7 if [ $# -le 0 ]; then
8 echo "Usage: $0 repository"
9 exit 1
10 fi
11
12 # Switch to directory
13 cd $GITROOT
14
15 # Handle args
16 for repo in $@; do
17 if [ -d "$GITROOT/$repo" ]; then
18 echo "Warning: $GITROOT/$repo already exists"
19 else
20 # Create directory
21 mkdir "$GITROOT/$repo"
22 # Switch to directory
23 pushd "$GITROOT/$repo" > /dev/null
24 # Init bare repository
25 git --bare init --shared --initial-branch=master . > /dev/null
26 # Make it work
27 git update-server-info
28 # Allow push
29 git config http.receivepack true
30 # Fix ownership
31 chown -R apache:apache .
32 # Return in old dir
33 popd > /dev/null
34 fi
35 done