泉州seo网站排名,全球速卖通大学,株洲市建设局网站,移动端是什么创建局域网git裸仓库
不说废话#xff0c;直接上脚本
#!/bin/bash# 获取脚本所在的目录
script_path$( cd $( dirname ${BASH_SOURCE[0]} ) pwd )if [ $# -eq 0 ]; thenecho 请提供仓库的名称作为参数。exit 1
…创建局域网git裸仓库
不说废话直接上脚本
#!/bin/bash# 获取脚本所在的目录
script_path$( cd $( dirname ${BASH_SOURCE[0]} ) pwd )if [ $# -eq 0 ]; thenecho 请提供仓库的名称作为参数。exit 1
firepo_name$1
repo_path$script_path/$repo_name.git
ip_address$(ip addr show | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk {print $2} | cut -d/ -f1 | head -n 1)
urlssh://root$ip_address$script_path/$repo_name.git# 检查是否已经存在同名目录或文件
if [ -e $repo_path ]; thenecho 目录或文件 $repo_name 已经存在。请使用其他名称。exit 1
fi# 切换到脚本所在目录
cd $script_path# 创建裸仓库
git init --bare $repo_pathecho ------------------------------------------------------------------------
echo
echo 裸仓库 $url 创建成功。
echo
echo ------------------------------------------------------------------------cat EOF# 使用教程:## Git 全局设置:git config --global user.name DerekLiu
git config --global user.email yjkhtddxsina.com## 创建 git 仓库:mkdir $repo_name
cd $repo_name
git init
touch README.md
git add README.md
git commit -m first commit
git remote add origin $url
git push -u origin master## 已有仓库?cd existing_git_repo
git remote add origin $url
git push -u origin masterEOF
echo ------------------------------------------------------------------------