android 源码下载DownloadError: android.googlesource.com: <urlopen error [Errno 110] Connection timed out

因为之前的虚拟机奔溃,再次下载时回报DownloadError: android.googlesource.com: <urlopen error [Errno 104] Connection reset by peer>错误,

DownloadError: android.googlesource.com: <urlopen error [Errno 110] Connection timed out>

经过官网查找原因,发现

Using authentication
By default, access to the Android source code is anonymous. To protect the servers against excessive usage, each IP address is associated with a quota

 

When sharing an IP address with other users (e.g. when accessing the source repositories from beyond a NAT firewall), the quotas can trigger even for regular usage patterns (e.g. if many users sync new clients from the same IP address within a short period).

In that case, it is possible to use authenticated access, which then uses a separate quota for each user, regardless of the IP address.

 

也就是说同一IP再次下载会失效,

 

解决方案如下:

1. 浏览器登录https://android.googlesource.com/new-password,并用gmail帐号(就是你初始化repo时填写的gmail邮箱)登录;

2. 点击网页上的“允许访问”,

进入后copy “Staying Authenticated”下边灰色部分的内容:

1 machine android.googlesource.com login git...............

2 machine android-review.googlesource.com login git...................

3.将copy的内容写进~/.netrc文件中,如果你的/home下没有这个文件的话,可以创建一个

4. repo init -u https://android.googlesource.com/a/platform/manifest  (注意该URL中多了一个/a)

5. repo sync 

现在就可以下载Android源码。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值