一键备份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 红包祝福语简短10字
18 周六早晨祝福语简短