首页 > 解决方案 > 带有非 android 项目的回购

问题描述

我正在做一个项目,我试图将几个模块整合到一个解决方案中。每个模块都在它们自己的文件夹中,并且是 git 存储库。这些都存储在C:\sourcecode\Modules最终它们将在 GitHub 上。在深入审查了使用存储在 git 存储库中的模块组成的解决方案的不同方法之后,我决定尝试Repo为 AOSP 构建的 Google。

我根据这里的回购要求安装了所有工具https://source.android.com/setup/develop并在该文件夹C:\sourcecode\Repotest中创建了一个文件夹我创建了一个名为 default.xml 的文件。该文件夹的内容非常简单:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

  <remote  name="origin"
           fetch="/c/sourcecode/Modules" />
  <default revision="master"/>

  <project path="AnalystQualification" name="AnalystQualification" />
</manifest>

我以管理员身份启动 git-bash 并运行:

$ cd /c/sourcecode/Repotest/
$ repo init -u default.xml

我得到输出:

$ repo init -u default.xml
Downloading manifest from default.xml
Traceback (most recent call last):
  File "C:\sourcecode\Repotest\.repo\repo\main.py", line 630, in <module>
    _Main(sys.argv[1:])
  File "C:\sourcecode\Repotest\.repo\repo\main.py", line 604, in _Main
    result = run()
  File "C:\sourcecode\Repotest\.repo\repo\main.py", line 597, in <lambda>
    run = lambda: repo._Run(name, gopts, argv) or 0
  File "C:\sourcecode\Repotest\.repo\repo\main.py", line 266, in _Run
    result = cmd.Execute(copts, cargs)
  File "C:\sourcecode\Repotest\.repo\repo\subcmds\init.py", line 531, in Execute
    self._SyncManifest(opt)
  File "C:\sourcecode\Repotest\.repo\repo\subcmds\init.py", line 232, in _SyncManifest
    default_branch = m.ResolveRemoteHead()
  File "C:\sourcecode\Repotest\.repo\repo\project.py", line 1926, in ResolveRemoteHead
    output = self.bare_git.ls_remote('-q', '--symref', '--exit-code', name, 'HEAD')
  File "C:\sourcecode\Repotest\.repo\repo\project.py", line 3040, in runner
    raise GitError('%s %s: %s' %
error.GitError: manifests ls-remote: fatal: invalid gitfile format: default.xml
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

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

我认为这个错误告诉我 default.xml 中的设置看不到目录中的 .git 文件夹,modules/analystqualification但如果我可以看到它ls -l

$ ls -l /C/sourcecode/Modules/AnalystQualification
total 4
drwxr-xr-x 1 adam.wheeler 1049089 0 Jan 12 10:01 Setup_AQ/

任何帮助在这里表示赞赏。谢谢!

亚当

标签: androidgitrepo

解决方案


repo init -u url_to_manifest_repo -m foo.xml -b manifest_repo_branch

url_to_manifest_repo应该是一个跟踪foo.xml. 它可以在本地磁盘中,也可以在远程托管服务器中。在你的情况下,它是/c/sourcecode/Repotest. 确保这/c/sourcecode/Repotest是一个 git 存储库并且default.xml已被跟踪。

foo.xml是清单文件相对于url_to_manifest_repo根目录的路径。-m foo.xml可以省略。如果是这样,-m default.xml则默认使用。

manifest_repo_branch是保存特定版本的分支foo.xml。如果-b manifest_repo_branch省略,则默认为-b master.

因此,在您的情况下,命令将是:

repo init -u /c/sourcecode/Repotest -m default.xml -b master

或者简单地说:

repo init -u /c/sourcecode/Repotest

对于本地存储库,它也可以是-u file:///c/sourcecode/Repotest.


推荐阅读