mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 8ab54ef1ded87b6a83407bcf1b132e42f87a6940
parent 9fe6211e8eac0d0c04d0491f66cdb5de9fbab7c8
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Thu, 10 May 2018 00:20:19 +0200

script to initialize a git repository

Diffstat:
initgit | 35+++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+), 0 deletions(-)

diff --git a/initgit b/initgit @@ -0,0 +1,35 @@ +#!/bin/bash + +NAME="$1" +shift +DESC="$@" + +HOSTNAME=$(hostname | cut -d. -f1) +if [[ $HOSTNAME != "ulminfo" ]] +then + exec ssh ulminfo bin/initgit "$NAME" "$DESC" +fi + +if [ -d "$HOME/git/${NAME}.git" ] +then + echo "repository $NAME already exists?! aborting" + exit 42 +fi + +cd "$HOME/git" +git init --bare "${NAME}.git" +cd "${NAME}.git" +echo "$DESC" > description +echo "https://a3nm.net/git/$NAME/" > url +git update-server-info + +cd hooks +mv post-update.sample post-update +ln -s "$HOME/bin/stagit-post-receive.sh" post-receive +cd .. + +mkdir "$HOME/public_html/git/${NAME}" +ln -s "$HOME/git/${NAME}.git" "$HOME/public_html/git/" + +chmod -R og+rx "$HOME/git/${NAME}.git" +