Once run, the warehouse on the Gitolite server can be backed up to the local. The first run creates a local mirror of the remote warehouse, which updates the local mirror each time it runs.
This program only supports SSH mode
Other GIT servers do not seem to return the repo list when SSH git@xxx, so they can only be backed up manually.
#!/bin/sh server=serv_addr
root_dir= ' pwd '
echo ' Whill back in dir: ${root_dir} '
ssh ' git@${server} ' | awk ' { Print $1$2,$3} ' | grep "^RW" | awk ' {print $} ' | While the read line do
echo ""
echo "-------------------------------------"
if [! -D "${root_dir}/${line}.git"]; Then
echo "Repo not init", init it ... "
mkdir-p" ${root_dir}/${line}.git "
CD" ${root_dir}/${line}.gi T "
CD..
git clone--mirror "Git@${server}:${line}.git"
else
echo repo already init on local, update it ... "
CD" ${ Root_dir}/${line}.git "
git remote update
git gc
fi done