aboutsummaryrefslogtreecommitdiff
path: root/git-shell-commands/new-repo
blob: 4a32ad4edeab98f679c98d393e932a13fe391ef8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
# this script allows the creation of new repos over ssh on git server
# USAGE:
# ssh git@<host> new-repo <project name>
# - follow the prompts

PROJECT_NAME="$1"
if [[ -z "$1" ]]; then
  echo "project name cannot be empty"
  exit 1
fi
if [[ $PROJECT_NAME!=*.git ]]; then
  PROJECT_NAME="${PROJECT_NAME}.git"
fi

git --bare init "${PROJECT_NAME}"

echo "project created"
#vim: filetype=bash