From cd0695dbaf79a4f2dbd01b08868ccfae3a80c761 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Mon, 30 Oct 2017 09:40:47 +0200 Subject: [PATCH] New Git command Init, create a new project in my Git hosting. --- Documents/bin/git-Init | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 Documents/bin/git-Init diff --git a/Documents/bin/git-Init b/Documents/bin/git-Init new file mode 100755 index 0000000..00c3fea --- /dev/null +++ b/Documents/bin/git-Init @@ -0,0 +1,22 @@ +#!/bin/sh +set -eu + +die () { + echo "$@" + exit 1 +} + +usage () { + die "Usage: $0 repo_name" +} + +[ "$#" = "1" ] || usage +reponame="$1" +# shellcheck disable=SC2029 +ssh cgit.shore.co.il "git init --bare /srv/git/$reponame" +git clone "cgit.shore.co.il:/srv/git/$reponame" +( +cd "$reponame" +git commit --allow-empty --message "Initial empty commit." +git push +) -- GitLab