Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.

Troubleshoot and fix sync issues

This page explains how to troubleshoot and fix issues related to the repo sync command.

Fix network issues

This section provides several suggestions for fixing network issues that can cause unsuccessful syncs.

Use authentication to avoid quota barriers

To protect the servers against excessive use, each IP address that's used to access source is associated with a quota.

When sharing an IP address with other users, such as when accessing the source repositories from beyond a NAT firewall, quotas can trigger for normal patterns. For example, a quota can trigger when several users sync new clients from the same IP address, within a short period.

To avoid triggering quotas, you can use authenticated access, which uses a separate quota for each user, regardless of the IP address.

To enable authenticated access:

  1. Create a password with the password generator.

  2. Run the following command to convert your client to use automatic authentication (without changing branch):

    $repoinit-uhttps://android.googlesource.com/a/platform/manifest
    

    Note that the /a/ directory prefix triggers automatic authentication.

Configure for proxy use

If you're downloading source from behind a proxy, as is common in some corporate environments, make sure that you explicitly specify a proxy for Repo to use by running these commands:

$exportHTTP_PROXY=http://proxy_user_id:proxy_password@proxy_server:proxy_port
$exportHTTPS_PROXY=http://proxy_user_id:proxy_password@proxy_server:proxy_port

Adjust TCP/IP settings to avoid connectivity issues

While it's rare, Linux clients can experience connectivity issues, such as getting stuck in the middle of downloads while receiving objects. To improve this issue, adjust the settings of the TCP/IP stack or use nonparallel connections. You must have root access to modify the TCP setting. To modify the setting, issue the following commands:

$sudosysctl-wnet.ipv4.tcp_window_scaling=0
$reposync-j1

Use a local mirror to avoid network latency

When using several clients, you can create a local mirror of the entire server content and sync clients from that mirror without accessing the network. Follow these instructions to create a local mirror in at ~/aosp-mirror/ and sync clients against that mirror:

  1. Create and sync the mirror:

    $mkdir-p/usr/local/aosp/mirror
    $cd/usr/local/aosp/mirror
    $repoinit-uhttps://android.googlesource.com/mirror/manifest--mirror
    

    These commands create a local mirror in /user/local/aosp/mirror and initialize the mirror using the --mirror flag with the repo init command.

  2. Sync the clients from the mirror:

    $mkdir-p/usr/local/aosp/main
    $cd/usr/local/aosp/main
    $repoinit-u/usr/local/aosp/mirror/platform/manifest.git-bandroid-latest-release
    $reposync
    
  3. Sync the mirror against the server and sync the clients against the mirror:

    $cd/usr/local/aosp/mirror</code>
    $reposync
    $cd/usr/local/aosp/android-latest-release
    $reposync
    

It's possible to store the mirror on a LAN server and to access it over NFS, SSH, or Git. It's also possible to store it on a removable drive and to pass that drive among users or machines.

Use a partial clone

If you're using Git version 2.19 or later, specify --partial-clone when performing repo init to overcome any low-latency network issues:

$repoinit-uhttps://android.googlesource.com/platform/manifest-bandroid-latest-release--partial-clone--clone-filter=blob:limit=10M

Instead of initializing Repo to download everything, this command downloads Git objects as they are needed.

Troubleshoot 403 or 500 errors (proxy issues)

The repo init or repo sync commands might fail with either a 403 or 500 error. Most often these errors are related to HTTP proxies struggling to handle the large data transfers.

While there isn't a specific fix to these errors, using the most recent Python version and explicitly using repo sync -j1 can sometimes help.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025年12月02日 UTC.