diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-07-04 18:12:10 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-07-04 18:46:35 +0530 |
| commit | 2cd9a4039c0c5f524df0a33605c9baef1f57917e (patch) | |
| tree | 5e17ce2f0c78d663cf6f2f7be5abe769dc7a3f71 /cgit/ssh/git-shell-commands/new | |
| parent | ef34b26068c4e25f929a584edda63b8878c063b3 (diff) | |
| download | bacchus-remote-2cd9a4039c0c5f524df0a33605c9baef1f57917e.tar.gz bacchus-remote-2cd9a4039c0c5f524df0a33605c9baef1f57917e.zip | |
Add git shell commands
Diffstat (limited to 'cgit/ssh/git-shell-commands/new')
| -rwxr-xr-x | cgit/ssh/git-shell-commands/new | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cgit/ssh/git-shell-commands/new b/cgit/ssh/git-shell-commands/new new file mode 100755 index 0000000..ec2d8ca --- /dev/null +++ b/cgit/ssh/git-shell-commands/new @@ -0,0 +1,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}" |
