创建git repository的脚本

简介:

#!/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











本文转自ting2junshui51CTO博客,原文链接:http://blog.51cto.com/ting2junshui/1729652 ,如需转载请自行联系原作者

相关文章
|
3月前
|
存储 前端开发 开发工具
Git提交前的必备神器——自动清除调试语句脚本
Git提交前的必备神器——自动清除调试语句脚本
30 0
|
安全 网络安全 开发工具
git 提示:fatal: Could not read from remote repository.
git 提示:fatal: Could not read from remote repository.
642 0
git 提示:fatal: Could not read from remote repository.
|
14天前
|
网络安全 数据安全/隐私保护
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
|
22天前
|
开发工具 git
自动化脚本之Git相关
自动化脚本之Git相关
16 0
|
6月前
|
网络安全 开发工具 git
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
190 0
|
3月前
|
JavaScript 持续交付 开发工具
Git自动化利器:使用Node.js脚本定制化提交消息处理
Git自动化利器:使用Node.js脚本定制化提交消息处理
63 0
|
8月前
|
开发工具 git 开发者
解决fatal: not a git repository (or any of the parent directories): .git问题
解决fatal: not a git repository (or any of the parent directories): .git问题
1096 1
|
9月前
|
Shell 开发工具 git
教你写一个快速提交git代码的shell脚本(二)
教你写一个快速提交git代码的shell脚本(二)
|
5月前
|
开发工具 git
解决:fatal: not a git repository (or any of the parent directories): .git的问题
解决:fatal: not a git repository (or any of the parent directories): .git的问题
|
9月前
|
Unix Shell Linux
教你写一个快速提交git代码的shell脚本(一)
教你写一个快速提交git代码的shell脚本(一)
教你写一个快速提交git代码的shell脚本(一)