前两天按照书上的流程下载android源代码,下载repo之后,在执行下载时遇到如下错误:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
Getting repo ...
from git://android.git.kernel.org/tools/repo.git
android.git.kernel.org[0: 204.152.191.45]: errno=Operation timed out
android.git.kernel.org[0: 149.20.20.141]: errno=Operation timed out
fatal: unable to connect a socket (Operation timed out)
在网上查了查有人说是防火墙问题,可是我关闭了防火墙还是有着样的问题。
还有人说是git使用的端口无法访问,由于我是教育网,使用的学校的代理,于是怀疑是学校代理屏蔽了git端口。
我在网上找了一个教育网代理,使用下面的方法,终于成功的解决了问题:
先下载 corkscrew : http://www.agroman.net/corkscrew/
tar zxvf corkscrew-2.0.tar.gz
cd corkscrew-2.0
./configure
make
cp corkscrew ~/bin # or to any directory in your $PATH
然后在 ~/bin创建一个shell脚本 'git-proxy' :
#!/bin/sh
exec ~/bin/corkscrew <proxy name> <proxy port> $*
~/bin/ 和 <...>根据你的环境来替代 .
然后执行下面的命令:
git config --global core.gitproxy '~/bin/git-proxy'
现在在使用repo来下载android源代码,便没问题了。