【转】Creating an Android Mirror

from: http://blog.chinaunix.net/u3/92787/showart_2060961.html

Creating an Android Mirror
1. Prerequisites/Assumptions
install repo git http://sites.google.com/a/android.com/opensource/download

2.Setting up a Git Server
a.sudo apt-get install git-daemon
b.change iptables, git-daemon use tcp port 9481
sudo /sbin/iptables -A INPUT -p tcp -m tcp --dport 9481 -j ACCEPT
c.config /etc/sv/git-daemon/run, to export git trees in "/opt/coderepo"
====================================================
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec git-daemon --verbose --export-all --base-path=/opt/coderepo /opt/coderepo
====================================================

restart git-daemon: sudo /etc/init.d/git-daemon retart

d.git-dameon log file: /var/log/git-daemon/current


3. Using Git Behind a Firewall
install corkscrew http://www.agroman.net/corkscrew
create a new file called "git-proxy.sh" with following contents and replace <proxy-name> and <proxy-port>
==================================================
#!/bin/sh
exec /usr/bin/corkscew <proxy-name> <proxy-port> $*
==================================================
chmod a+x git-proxy.sh
git config --global core.gitproxy '<path to proxy>/git-proxy.sh'

to configure git to only use the proxy for specific URLs
git config --global core.gitproxy '"<path to proxy>/git-proxy.sh" for kernel.org' 'for kernel.org$'

4. Create the mirror.
mkdir /opt/coderepo/myandroid
cd /opt/coderepo/myandroid
repo init -u git://android.git.kernel.org/platform/manifest.git --mirror
repo sync

5.change manifest.git config, if not , can not push code change
cd /opt/coderepo/myandroid/platform/manifest.git
edit config file, add following lines
[daemon]
uploadpack=true
uploadarch=true
receivepack=true

6. change manifest.git
a.clone manifest.git
cd ~
git clone git://android.git.kernel.org/platform/manifest.git

b.Edit the file "~/manifest.git/default.xml"
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="korg"
- fetch="git://android.git.kernel.org/"
+ fetch="git://<your local ip>/myandroid/"
review="review.source.android.com" />
<default revision="master"
remote="korg" />

c. commit and push this change.
git commit -a
git push git://<your local ip>/myandroid/platform/manifest.git

7. The setup of the mirror is now complete. make a test
cd ~
mkdir testmirror
repo init -u git://<you local ip>/myandroid/platform/manifest.git
repo sync

8.References
http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html
http://sites.google.com/a/android.com/opensource/download
http://sites.google.com/a/android.com/opensource/download/using-repo

repo mirror允许上传:

repo forall -c 'git config receive.denyNonFastForwards True'
repo forall -c 'git config daemon.uploadpack true'
repo forall -c 'git config daemon.uploadarch true'
repo forall -c 'git config daemon.receivepack true'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值