git 创建服务端库Shell脚本



Shell 脚本如下:

#!/bin/bash

main()
{
    if [ $# -ne 1 ];
    then
        echo -e '请在命令后面加上项目名称'
       return;
    fi

        cd /home/git/gitRepo
        git init --bare ${respName}.git
        chown -R git:git ${respName}.git
        chmod go-wrx ${respName}.git
        cd ~
}

respName=$1

alias ..='cd ..'
curdate=`date '+%Y%m%d'`

#execute main function
main $@


执行脚本:

. 脚本文件名  仓库名称
例如: . initResp test

就会创建test.git的仓库


你可能感兴趣的:(LINUX,git)