Browse code

Add a simple script to create a new Git repository.

Xavier G authored on 21/07/2016 01:00:22
Showing 2 changed files
1 1
new file mode 120000
... ...
@@ -0,0 +1 @@
1
+create-public-repository
0 2
\ No newline at end of file
1 3
new file mode 100755
... ...
@@ -0,0 +1,6 @@
1
+#!/bin/bash
2
+git_root='/srv/git/repositories'
3
+[[ "${0}" == *"private"* ]] && git_mode='0660'
4
+git init --bare --shared="${git_mode:-0664}" "${git_root}/${1}" || exit $?
5
+vim "${git_root}/${1}/description"
6
+perl -i -ple 's,^\s*denyNonFastforwards\s*=.*$,	denyNonFastforwards = false,' "${git_root}/${1}/config"