创建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 ,如需转载请自行联系原作者

相关文章
|
存储 前端开发 开发工具
Git提交前的必备神器——自动清除调试语句脚本
Git提交前的必备神器——自动清除调试语句脚本
130 0
|
安全 网络安全 开发工具
git 提示:fatal: Could not read from remote repository.
git 提示:fatal: Could not read from remote repository.
1825 0
git 提示:fatal: Could not read from remote repository.
|
开发工具 git C++
【App Service】VS Code直接部署App Service时候遇见 “fatal: not a git repository (or any of the parent directories): .git”
通过VS Code发布Python App Service的时候,遇见了发布失败错误: The deployment failed with error: fatal: not a git repository (or any of the parent directories): .git . Please take a few minutes to help us improve the deployment experience
257 24
|
开发工具 git Python
通过Python脚本git pull 自动重试拉取代码
通过Python脚本git pull 自动重试拉取代码
391 5
|
Ubuntu Shell 开发工具
ubuntu/debian shell 脚本自动配置 gitea git 仓库
这是一个自动配置 Gitea Git 仓库的 Shell 脚本,支持 Ubuntu 20+ 和 Debian 12+ 系统。脚本会创建必要的目录、下载并安装 Gitea,创建 Gitea 用户和服务,确保 Gitea 在系统启动时自动运行。用户可以选择从官方或小绿叶技术博客下载安装包。
535 2
|
开发工具 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问题
2606 1
|
Shell 开发工具 git
教你写一个快速提交git代码的shell脚本(二)
教你写一个快速提交git代码的shell脚本(二)
|
网络安全 开发工具 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
1368 0
|
监控 安全 开发工具
git fatal: detected dubious ownership in repository at ‘xxx‘ 彻底解决方法
调整文件所有权和权限后,你应该能够无误地进行Git操作。持续的维护与监控文件系统的安全性能降低将来遇到类似问题的风险,并保证团队能够高效协作。如果你是在团队环境中工作,建议建立明确的协作规则和文件管理实践,以避免此类问题。
1795 3
|
前端开发 JavaScript PHP
【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
178 0