[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-08 (世界標準時間)。"],[],[],null,["# Troubleshoot and fix sync issues\n\nThis page explains how to troubleshoot and fix issues related to\nthe `repo sync` command.\n\nFix network issues\n------------------\n\nThis section provides several suggestions for fixing network issues that can\ncause unsuccessful syncs.\n| **Tip:** Resyncing after an error can often fix a sync issue.\n\n### Use authentication to avoid quota barriers\n\nTo protect the servers against excessive use, each IP address that's used to\naccess source is associated with a quota.\n\nWhen sharing an IP address with other users, such as when accessing the source\nrepositories from beyond a NAT firewall, quotas can trigger for normal\npatterns. For example, a quota can trigger when several users sync new clients\nfrom the same IP address, within a short period.\n\nTo avoid triggering quotas, you can use authenticated access, which uses a\nseparate quota for each user, regardless of the IP address.\n\nTo enable authenticated access:\n\n1. Create a password with [the password generator](https://android.googlesource.com/new-password).\n\n2. Run the following command to convert your client to use automatic\n authentication (without changing branch):\n\n $ repo init -u https://android.googlesource.com/a/platform/manifest\n\n Note that the `/a/` directory prefix triggers automatic authentication.\n\n### Configure for proxy use\n\nIf you're downloading source from behind a proxy, as is common in some\ncorporate environments, make sure that you explicitly specify a proxy for Repo\nto use by running these commands: \n\n $ export HTTP_PROXY=http://\u003cvar translate=\"no\"\u003eproxy_user_id\u003c/var\u003e:\u003cvar translate=\"no\"\u003eproxy_password\u003c/var\u003e@\u003cvar translate=\"no\"\u003eproxy_server\u003c/var\u003e:\u003cvar translate=\"no\"\u003eproxy_port\u003c/var\u003e\n $ export HTTPS_PROXY=http://\u003cvar translate=\"no\"\u003eproxy_user_id\u003c/var\u003e:\u003cvar translate=\"no\"\u003eproxy_password\u003c/var\u003e@\u003cvar translate=\"no\"\u003eproxy_server\u003c/var\u003e:\u003cvar translate=\"no\"\u003eproxy_port\u003c/var\u003e\n\n### Adjust TCP/IP settings to avoid connectivity issues\n\nWhile it's rare, Linux clients can experience connectivity issues, such as\ngetting stuck in the middle of downloads while receiving objects. To improve\nthis issue, adjust the settings of the TCP/IP stack or use nonparallel\nconnections. You must have root access to modify the TCP setting. To modify the\nsetting, issue the following commands: \n\n $ sudo sysctl -w net.ipv4.tcp_window_scaling=0\n $ repo sync -j1\n\n### Use a local mirror to avoid network latency\n\nWhen using several clients, you can create a local mirror of the entire server\ncontent and sync clients from that mirror without accessing the\nnetwork. Follow these instructions to create a local mirror in at\n`~/aosp-mirror/` and sync clients against that mirror:\n\n1. Create and sync the mirror:\n\n $ mkdir -p /usr/local/aosp/mirror\n $ cd /usr/local/aosp/mirror\n $ repo init -u https://android.googlesource.com/mirror/manifest --mirror\n\n These commands create a local mirror in `/user/local/aosp/mirror` and\n initialize the mirror using the `--mirror` flag with the `repo init`\n command.\n2. Sync the clients from the mirror:\n\n $ mkdir -p /usr/local/aosp/main\n $ cd /usr/local/aosp/main\n $ repo init -u /usr/local/aosp/mirror/platform/manifest.git -b android-latest-release\n $ repo sync\n\n3. Sync the mirror against the server and\n sync the clients against the mirror:\n\n $ cd /usr/local/aosp/mirror\u003c/code\u003e\n $ repo sync\n $ cd /usr/local/aosp/android-latest-release\n $ repo sync\n\nIt's possible to store the mirror on a LAN server and to access it over NFS,\nSSH, or Git. It's also possible to store it on a removable drive and to pass\nthat drive among users or machines.\n\n### Use a partial clone\n\nIf you're using Git version 2.19 or later, specify `--partial-clone` when\nperforming `repo init` to overcome any low-latency network issues: \n\n $ repo init -u https://android.googlesource.com/platform/manifest -b android-latest-release --partial-clone --clone-filter=blob:limit=10M\n\nInstead of initializing Repo to download everything, this command downloads Git\nobjects as they are needed.\n\nTroubleshoot 403 or 500 errors (proxy issues)\n---------------------------------------------\n\nThe `repo init` or `repo sync` commands might fail with either a 403 or 500\nerror. Most often these errors are related to HTTP proxies struggling to\nhandle the large data transfers.\n\nWhile there isn't a specific fix to these errors, using the most recent Python\nversion and explicitly using `repo sync -j1` can sometimes help."]]