下载android代码,repo sync的时候遇到以下报错

    Exception in thread Thread-3:  
    Traceback (most recent call last):  
      File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner  
      self.run()  
      File "/usr/lib/python2.6/threading.py", line 484, in run  
      self.__target(*self.__args, **self.__kwargs)  
      File "/home/haili/android-4.0.4_r1.2/.repo/repo/subcmds/sync.py", line 200, in _FetchHelper  
      clone_bundle=not opt.no_clone_bundle)  
      File "/home/haili/android-4.0.4_r1.2/.repo/repo/project.py", line 978, in Sync_NetworkHalf  
      and self._ApplyCloneBundle(initial=is_new, quiet=quiet):  
      File "/home/haili/android-4.0.4_r1.2/.repo/repo/project.py", line 1519, in _ApplyCloneBundle  
      exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet)  
      File "/home/haili/android-4.0.4_r1.2/.repo/repo/project.py", line 1583, in _FetchBundle  
      raise DownloadError('%s: %s ' % (req.get_host(), str(e)))  
    DownloadError: android.googlesource.com: <urlopen error [Errno 110] Connection timed out>    
    ...  

一开始以为是网站被屏蔽了,试了很多FQ手段都不行,后来发觉不是。解决方法很简单,本机打开https://android.googlesource.com/new-password,并且用gmail帐号登录以后得到类似于

    machine android.googlesource.com login git-<userName>.gmail.com password <password>  
    machine android-review.googlesource.com login git-<userName>.gmail.com password <password>  

的信息。将这段信息添加到~/.netrc下之后,重新通过https://android.googlesource.com/a/platform/manifest同步源代码,按照步骤来就能正常下载了