1. 初始化要下载的文件列表:
cd ~/android/src repo init -u git://android.git.kernel.org/platform/manifest.git
如果想检出除master外其他分支上的代码可以用-b选项:
cd ~/android/src repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
2. 配置git帐户
git config --global user.email "xxxxx@xxxxxxx" git config --global user.name "xxxxxx"
3. 同步文件列表:
repo sync
在第一次下载全部代码完成后,可以按模块更新子项目的代码:
repo sync project-path
其中的project-path可以在src/.repo/manifests/default.xml中找到:
<?xml version="1.0" encoding="UTF-8"?> <manifest> <remote name="korg" fetch="git://android.git.kernel.org/" review="review.source.android.com" /> <default revision="master" remote="korg" /> <project path="build" name="platform/build"> <copyfile src="core/root.mk" dest="Makefile" /> </project> <project path="kernel" name="kernel/common" revision="refs/heads/android-2.6.27" /> <project path="bionic" name="platform/bionic" /> <project path="bootable/bootloader/legacy" name="platform/bootable/bootloader/legacy" /> <project path="bootable/diskinstaller" name="platform/bootable/diskinstaller" /> <project path="bootable/recovery" name="platform/bootable/recovery" /> ... ...
在网关内部使用需要设置代理:
新建如下文件:
#!/bin/sh # /home/justin/android/bin/socks-gw.sh # This script connects to a HTTP proxy using connect.c connect -H wwwgate.freeshell.net:8080 $@
#!/bin/sh # /home/justin/android/bin/socks-ssh.sh ssh -o ProxyCommand="/home/justin/android/bin/socks-gw.sh %h %p" $@
增加这两个文件的可执行权限:
chmod a+x /home/justin/android/bin/socks-ssh.sh chmod a+x /home/justin/android/bin/socks-gw.sh
可以将所有代理的环境变量放在:
#!/bin/sh # /home/justin/proxy.sh # http proxy setting export HTTP_PROXY=http://wwwgate.freeshell.net:8080 export http_proxy=$HTTP_PROXY # set git to use ssh over http proxy export GIT_SSH="/home/justin/android/bin/socks-ssh.sh" export GIT_PROXY_COMMAND="/home/justin/android/bin/socks-gw.sh"
需要的时候运行:
. ~/proxy.sh