一键备份gitolite服务器的Shell脚本
运行一次就能够把gitolite服务器上的仓库备份到本地.第一次运行会创建远程仓库的本地镜像,以后每次运行会把本地镜像更新.
本程序只支持ssh方式
其他的gitserver貌似不会在sshgit@xxx的时候返回repo列表,所以只能手动备份.
#!/bin/shserver=serv_addr
root_dir=`pwd`
echo"whillbackindir:${root_dir}"
ssh"git@${server}"|awk'{print$1$2,$3}'|grep"^RW"|awk'{print$2}'|whilereadlinedo
echo""
echo"-------------------------------------"
if[!-d"${root_dir}/${line}.git"];then
echo"reponotinitonlocal,initit..."
mkdir-p"${root_dir}/${line}.git"
cd"${root_dir}/${line}.git"
cd..
gitclone--mirror"git@${server}:${line}.git"
else
echo"repoalreadyinitonlocal,updateit..."
cd"${root_dir}/${line}.git"
gitremoteupdate
gitgc
fidone热门推荐
10 五一公司放假祝福语简短
11 追星女孩的祝福语简短
12 给长辈端午祝福语 简短
13 生日祝福语有诗意简短
14 团圆日祝福语简短
15 中秋商务祝福语简短最新
16 温暖文艺简短祝福语短句
17 男孩上学祝福语简短的
18 入住酒店文案祝福语简短