~/bin/repo$chmoda+x~/bin/repo2.建立本地版本库$mkdir" />
$ mkdir ~/bin
$ echo "export PATH=~/bin:\$PATH" >> ~/.bashrc
$ source ~/.bashrc
获取repo并赋予可执行权限(或者参考google官方网站) $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo
$ mkdir -p /work/git/android
$ cd /work/git/android
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror
$ repo sync -j8
安装git-daemon
$sudo apt-get install git-daemon-run
修改配置
$sudo vi /etc/sv/git-daemon/run
将文件中的最后一行:
"$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache /var/cache/git
修改为:
"$(git --exec-path)"/git-daemon --verbose --export-all --base-path=/work/git/ /work/git/
最终效果如下:
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugitdaemon \
"$(git --exec-path)"/git-daemon --verbose --export-all --base-path=/work/git/ /work/git/
# "$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache /var/cache/git
重启git-daemon服务
$sudo sv stop git-daemon
$sudo sv start git-daemon
查看服务是否启动
$sudo ps aux | grep "git"
通过git访问使用(默认你已经自行安装配置好repo):
$ repo init -u git://192.168.1.183/android/platform/manifest.git --repo-url=git://192.168.1.183/android/platform/tools/repo.git
或指定版本
$ repo init -u git://192.168.1.183/android/platform/manifest.git -b android-4.1.1_r2 --repo-url=git://192.168.1.183/android/platform/tools/repo.git
在192.168.1.183上本地目录访问:
repo init -u /work/git/android/platform/manifest.git --repo-url=/work/git/android/platform/tools/repo.git
或指定版本
repo init -u /work/git/android/platform/manifest.git -b android-4.1.1_r2 --repo-url=/work/git/android/platform/tools/repo.git
可参考google官方网站
By Leslie Guan