blob: ec2d8caf13201f109f00a7d631d6672b0e4faa3d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env sh
set -eu
remote_host="git.ediblemonad.dev"
owner_info="Akshay Nair <phenax5@gmail.com>"
if [ $# -lt 2 ]; then
echo "Usage: new <name> <...description>" 1>&2
exit 1
fi
repo_name="$1"; shift 1;
[ -z "$repo_name" ] && echo "Error: empty repo name" 1>&2 && exit 1
# Stupid cmdline parsing means I can't do $1 here for space separated stuff
description="$*"
[ -z "$description" ] && echo "Error: empty description" 1>&2 && exit 1
repo_dir="/git/${repo_name}.git"
if [ -d "$repo_dir" ]; then
echo "Error: $repo_name already exists" 1>&2
exit 1;
fi
git --bare init "$repo_dir"
cd "$repo_dir"
echo "$description" > description
echo "$owner_info" > owner_info
echo "git@${remote_host}:${repo_dir}"
|