一键备份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 婆婆高寿祝福语大全简短