1. Create / update local mirror :
#!/bin/bash
MIRROR_DIR=/android-mirror
SVR=https://source.android.com
cd $MIRROR_DIR
for p in `ssh $SVR gerrit ls-projects`
do
if [ -d "$p.git" ]; then
echo Update ... "$p.git"
# update existing git db
git --git-dir "$p.git" remote prune origin
git --git-dir "$p.git" fetch
else
mkdir -p `dirname "$p"`
echo Mirror ... ${p}.git
# fist time init
git clone --mirror "ssh://$SVR/$p.git" "$p.git"
fi
done
2. Repo from local mirror :
repo init -u /android-mirror/mainfest -b xxx-branch -m xxx-mainfest --reference /android-mirror
repo sync
Pro :
1. Sync data locally, so faster.
2. Local mirror can offline move to other place, able to work from home.
3. Share .git data with local mirror, save space.
Con :
1. Not sure if git push working or not.
No comments:
Post a Comment