From a266238855d1a08763b1bf5928409a4aecfa9a67 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 19 Aug 2016 11:56:20 +0100 Subject: [PATCH] git_create --- etc/profile.d/git.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/etc/profile.d/git.sh b/etc/profile.d/git.sh index bf517098..46ac6b2e 100644 --- a/etc/profile.d/git.sh +++ b/etc/profile.d/git.sh @@ -74,11 +74,8 @@ GIT_REPO='git@git.nbdom.net' git_create() { # NB 14.04.16 shell_help_noarg "Usage: $FUNCNAME DIRECTORY" "$@" && return 1 # NB 14.04.16 declare dir="$1"; shift - shell_help "Usage: $FUNCNAME DIRECTORY" "$@" && return 1 + shell_help "Usage: $FUNCNAME create git project from current dir" "$@" && return 1 declare dir="$(basename $(pwd))" -# NB 21.08.15 declare name="${dir}.git" -# NB 30.07.15 declare name="${1%.git}" -# NB 30.07.15 declare dir=$(basename $name) declare repo="$GIT_REPO" [ -n "$1" ] && repo="$1" && shift @@ -88,11 +85,8 @@ git_create() { # NB 14.04.16 [ -e "$dir" ] && echo ">$dir already exists!" 1>&2 && return 1 echo ">git init --bare ${dir}.git" - ssh $repo "test -e ${dir}.git && echo "${dir}.git already exists on $repo" 1>&2 && exit 1; git init --bare ${dir}.git" || return - - #echo ">git clone ${repo}:${dir}.git ." - #git clone ${repo}:${dir}.git . || return - #cd $dir || return + local user=${repo%@*} + ssh root@${repo#*@} "cd ~git || exit; test -e ${dir}.git && echo "${dir}.git already exists on $repo" 1>&2 && exit 1; git init --bare ${dir}.git && chown $user.$user ${dir}.git" || return echo ">git init" git init -- 2.47.3