install repo
-
安装到bin目录下,并设置到环境变量中
$ mkdir ~/bin
$ PATH=~/bin:$PATH
下载repo工具,修改
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo
$ chmod a+x ~/bin/repo
download source workspace
新建一个source存放目录
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init
$ repo init -u URL [OPTIONS]
Installs Repo in the current directory. This creates a .repo/ directory that contains Git repositories for the Repo source code and the standard Android manifest files. The .repo/ directory also contains manifest.xml, which is a symlink to the selected manifest in the .repo/manifests/ directory.
Options:
-u: specify a URL from which to retrieve a manifest repository. The common manifest can be found at https://android.googlesource.com/platform/manifest
-m: select a manifest file within the repository. If no manifest name is selected, the default is default.xml.
-b: specify a revision, i.e., a particular manifest-branch. (see info from URL)
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.4_r1repo sync
开始同步代码
*下面有一个防止下载时掉线的sh脚本,感觉不错,转自网上
#! /bin/bash echo "=====start repo sync======" repo sync while [ $? = 1 ]; do echo “======sync failed, re-sync again======” sleep 3 repo sync done