公司使用代理上网,proxy不支持git,尝试了很多办法,最后成功。
方法如下:
1 安装Android build环境需要的工具
参考source.android.com "get source"
2 Installing Repo
- Make sure you have a~/bindirectory in your home directory, and check to be sure that this bin directory is in your path:
$ cd ~
$ mkdir bin
$ echo $PATH
- Download there poscript. and make sure it is executable:
$ export http_proxy=http://your.proxy:8080
$ curl http://android.git.kernel.org/repo >~/bin/repo $ chmod a+x ~/bin/repo
$ 修改repo文件
REPO_URL='git://android.git.kernel.org/tools/repo.git' 改成
REPO_URL='http://android.git.kernel.org/tools/repo.git'
Initializing a Repo client
- Create an empty directory to hold your working files:
$ mkdir mydroid
$ cd mydroid
- Run "repo init" to bring down the latest version of Repo with
all its most recent bug fixes. You must specify a URL for the manifest:
$ repo init
-u http://android.git.kernel.org/platform/manifest.git - If you would like to check out a branch other than "master", specify it with -b, like:
$ repo init
-u git://android.git.kernel.org/platform/manifest.git -b froyo
- When prompted, configure Repo with your real name and email
address. If you plan to submit code, use an email address that is
associated with a Google account
.
注意上面红色字体标注(git修改为http)
repo init成功之后,
打开 .repo\repo\project.py 修改_InitRemote函数
def _InitRemote(self):
if self.remote.url:
remote = self.GetRemote(self.remote.name)
#remote.url = self.remote.url
# use http instead
remote.url = self.remote.url.replace("git://", "http://") remote.review = self.remote.review
remote.projectname = self.name
if self.worktree:
remote.ResetFetch(mirror=False)
else:
remote.ResetFetch(mirror=True)
remote.Save()
然后执行
repo sync
(代理下载,下载一些大文件时,链接可能死掉,CTRL+C
再执行repo sync即可)
hope it may be helpful