Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Sunday, May 25, 2014

How to create a local mirror repository

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.


Sunday, January 10, 2010

Git 書籤

Git 初學筆記 - 指令操作教學
http://plog.longwin.com.tw/my_note-unix/2009/05/19/git-learn-initial-command-2009

Git 初學筆記 - 實作測試
http://plog.longwin.com.tw/my_note-unix/2009/05/20/git-learn-test-command-2009

Git 中文教程
http://www.bitsun.com/documents/gittutorcn.htm

使用 Git 管理源代碼
http://www.ibm.com/developerworks/cn/linux/l-git/index.html

Git 原始碼管理
http://www.qweruiop.org/nchcrails/posts/49

Everyday GIT With 20 Commands Or So
http://people.debian.org.tw/~jesse/git/everyday_zhtw.html