首页 > 其他 > 详细

创建git repository的脚本

时间:2015-12-29 19:39:49      阅读:233      评论:0      收藏:0      [点我收藏+]

#!/bin/bash

# 该脚本使用NFS文件系统,然后做软连接到/home/git目录下,然后设置相应的权限等。

#

Git_dir=/mnt/nfs/git/

Git_home=/home/git

read -p  "please input the new project name..." New_pro


cd $Git_dir


if [ -d $New_pro ] ; then

    rm -rf $New_pro

    mkdir -p $New_pro

else

    mkdir -p $New_pro

fi


#chown -R git:git $New_pro


cd $Git_home


link_repo() {

    ln -s $Git_dir$New_pro $Git_home

    cd $New_pro

    git init --bare --shared

    touch git-daemon-export-ok

    git update-server-info

    chown -R git:git $Git_dir$New_pro

}



if [ -L $New_pro ]; then

    rm -rf $New_pro

    link_repo

else

    link_repo

fi


创建git repository的脚本

原文:http://ting2junshui.blog.51cto.com/975290/1729652

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!