android-ndk开发(11): 安装 repo 命令

发布于:2025-05-10 ⋅ 阅读:(13) ⋅ 点赞:(0)

1. 长话短说

mkdir ~/soft/bin
curl -L https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod +x repo

~/.pathrc 添加:

export PATH=$PATH:~/soft/bin

2. 短话长说

repo 的官方介绍页面: https://gerrit.googlesource.com/git-repo/

repo 的官方下载地址: https://storage.googleapis.com/git-repo-downloads/repo

为啥不用官方的? 因为网络不好。 如果安装了, 即便开启代理, 使用仍然报错:

➜  android-ndk repo init -u https://android.googlesource.com/platform/manifest -b master-ndk --partial-clone

Downloading Repo source from https://gerrit.googlesource.com/git-repo
致命错误:无法访问 'https://gerrit.googlesource.com/git-repo/':The requested URL returned error: 429
repo: error: "git" failed with exit status 128
  cwd: /Users/zz/work/android-ndk/.repo/repo.tmp
  cmd: ['git', 'fetch', '--quiet', '--progress', 'origin', '+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']
fatal: double check your --repo-rev setting.
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

查看源码:

REPO_URL = os.environ.get("REPO_URL", None)
if not REPO_URL:
    REPO_URL = "https://gerrit.googlesource.com/git-repo"

恭喜你, 折返回到清华大学镜像: https://mirrors.tuna.tsinghua.edu.cn/help/git-repo/

3. 参考链接


网站公告

今日签到

点亮在社区的每一天
去签到