commit 053d7cda92d811f02cfcd9d7a321174f624f7a8a parent 316344f1b20ae57af84562ae1fc32fa7c9d170a6 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Fri, 17 Apr 2020 10:16:15 +0200 Offer to set created repo as remote origin Diffstat:
M | .profile | | | 13 | ++++++++++++- |
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/.profile b/.profile @@ -60,11 +60,22 @@ alias lo='l -alo' alias dot="git --git-dir=\$HOME/.dotfiles/ --work-tree=\$HOME" create-repo() { + user="git" + host="src.adamsgaard.dk" if [ $# -lt 1 ]; then printf 'usage: create-repo name\n' >&2 return 1 fi - ssh git@adamsgaard.dk "./create-repo.sh ${1}" + if ssh "${user}@${host}" "./create-repo.sh ${1}"; then + if [ -f .git/config ]; then + printf "add as remote origin? [Y/n] " + read + case "$REPLY" in + N|n) return 0;; + *) git remote add origin "${user}@${host}:${1}";; + esac + fi + fi } alias m='make'