一键备份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 给外婆敬酒祝福语简短