From c3bb6697861b50c140c608e27de57dc3a1f7712e Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Tue, 26 Jul 2022 06:20:27 +0530 Subject: [PATCH] Create git project direcotry with initial commit Signed-off-by: Bhaskar Chowdhury --- git_project_creation.sh | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/git_project_creation.sh b/git_project_creation.sh index de396e5..d72fc3b 100755 --- a/git_project_creation.sh +++ b/git_project_creation.sh @@ -2,11 +2,6 @@ # This script will crate git project in specified location,only need to pass the name of the porject. -#if [ $(id -u) -ne 0 ] ; then -# echo "Please run script as root user" -# exit 1 -#fi - if [ $# -ne 1 ] ; then echo "Usage : $0 " exit 2 @@ -14,17 +9,14 @@ fi ProjectName=$1 -cd /home/$USER/git-linux/ - -mkdir -p ${ProjectName}.git +basedir="/home/$USER/git-linux/" -cd ${ProjectName}.git/ +mkdir -p $basedir/${ProjectName} -git init --bare +chown -R $USER:$USER $basedir/${ProjectName} -cd .. - -chown -R $USER:$USER ${ProjectName}.git +cd $basedir/${ProjectName} +git init --bare && git init +git add . && git commit -s -m "intial commit" exit 0 -