首页 > 解决方案 > 如何设置本地 --repo-url 以避免从 googlesource 获取 repo 源代码?

问题描述

我使用 repo 和 gerrit 来管理源代码。当我运行 repo init 命令时

repo init -u gerrit_url/project -b branch_name

我看到 repo 尝试从 Google 获取源代码

Downloading Repo source from https://gerrit.googlesource.com/git-repo

我想避免它访问互联网。所以我 git clone https://gerrit.googlesource.com/git-repo然后 git push 到 gerrit_url/repo。然后我尝试使用 git clone gerrit_url/repo。有用。所以我改变了我的 repo init 命令

repo init -u gerrit_url/project -b branch_name --repo-url gerrit_url/repo

但我得到了奇怪的失败。

repo: error: "git" failed with exit status 128
cwd: /data/aken.hsu/Work/TEST/.repo/repo
cmd: ['git', 'describe', 'e7082ccb54ad870b185e99d7e39d1959c65ff899']
stderr:
>> fatal: No names found, cannot describe anything.
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

任何人都可以在这方面提供帮助吗?谢谢

标签: repo

解决方案


我回答我的问题。事实上,我所做的是正确的。但是当我从https://gerrit.googlesource.com/git-repo同步 Repo 源代码时,我添加了一个选项“--no-tags”。但是 repo init 会找到 Repo 存储库的标签。所以出现了这个错误。


推荐阅读