aboutsummaryrefslogtreecommitdiff
path: root/git-shell-commands/new-repo
blob: e85c2265465b7a3ed30a946438d8fa2e9cd73f13 (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