【问题标题】:Google repo tool (master branch) fails to sync from local mirror on WindowsGoogle repo 工具(master 分支)无法从 Windows 上的本地镜像同步
【发布时间】:2018-11-30 10:04:15
【问题描述】:

最近更新了 Google repo 工具的 master 分支以支持 Windows 操作系统。从提交日志中可以清楚地看出:https://gerrit.googlesource.com/git-repo/+log

我能够在 Windows 上使用 repo 工具(在 Windows 上使用 MinGW Git)运行 repo init 和 repo sync 等基本命令。在我的工作中,我需要创建一个存储库的本地镜像,然后使用它。 repo 工具可以很好地创建镜像存储库。

以下是用于在 Windows 操作系统的本地驱动器上创建镜像存储库的命令。

$ repo.cmd init -u <URL> -b <branch_name> -m <manifest_file_name> --mirror --no-repo-verify

$ repo.cmd sync --no-tags
  • --no-repo-verify 用于强制使用repo工具的master分支。
  • 以上命令在本地驱动器 C:\git-repo\test\mirror-testing\mirror 中创建镜像

但是当我将上述镜像同步到其他驱动器时,它会显示错误。

Command:
$ repo.cmd init -u <URL> -b <Branch_name> -m <manifest_file_name> --reference="C:\git-repo\test\mirror-testing\mirror" --no-repo-verify

Error:
error: object directory C:/git-repo/test/mirror-testing/mirror/project/manifest.git/objects? does not exist; check .git/objects/info/alternates.

上述命令在 C:/git-repo/test/mirror-testing/mirror/project/manifest.git/objects/info/ 目录中创建了替代文件,该文件包含以下路径:

C:\git-repo\test\mirror-testing\mirror\project/manifest.git\objects

我已经尝试过其他格式来提供参考价值:

Git format: "/C/git-repo/test/mirror-testing/mirror"
Cygwin format: "/cygdrive/c/git-repo/test/mirror-testing/mirror"

在引用中使用上述格式不会在对象目录中创建替代文件。

在上述所有情况下,repo init time 只是表明没有引用镜像,而 init 是从网络完成的。

当我使用 Cygwin Git + Google repo 工具(稳定分支)重复相同的测试时,我看不到任何错误,并且 repo 初始化时间和同步时间与镜像初始化和同步时间相比要少得多,这只是表明镜像。

  • repo.cmd 是一个批处理文件包装器,用于使用 python 调用 repo 工具。 repo.cmd 文件包含单行

    @call python %~dp0\repo %*

  • 我在 Windows 7 中使用 Cygwin 终端来运行这些命令。

  • 明确 repo init 和 repo sync 在引用镜像时显示错误,但通过从外部网络同步成功完成。问题是没有引用镜像。

有没有人在 Windows 上使用 Google repo 来创建镜像并在其他驱动器中同步用作参考?

【问题讨论】:

    标签: windows git repo


    【解决方案1】:

    我已经在 Windows 7 和 Windows 10 上使用 MinGW Git 测试了 Google repo 工具 master 分支。 repo init 和 repo sync 在两个操作系统上都可以工作。

    即使使用 --mirror 创建本地镜像也可以,但是将本地镜像引用到其他驱动器中同步不起作用并显示错误:“找不到对象目录”。

    为了清楚使用 --reference 和本地镜像会显示错误,但它最终会使用网络并忽略本地镜像。最终该命令成功完成,但它没有使用本地镜像。我目前在 Windows 上没有看到任何解决方法。

    同时,Windows 10 原生支持 Linux bash,无需使用任何虚拟机。 WSL 是适用于 Linux 的 Windows 子系统,是 Windows 10 的一项免费可选功能,允许 Linux 程序在 Windows 上运行。它为您提供了 Windows 版本的 bash shell 和允许许多 Linux 程序在您的 Windows 机器上本地运行的兼容层。使用此选项,您可以将 Cygwin Git 替换为 Linux Git。

    我已经在 Linux Bash(安装了 Ubuntu 发行版)上测试了 repo 工具,用于 repo init、sync、mirror 和 reference 命令,它可以工作。事实上,我们使用的是 Linux bash,所以 Goole repo stable 分支可以正常工作,您不需要使用 master 分支来使其工作。

    【讨论】:

      猜你喜欢
      • 2023-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-07
      • 1970-01-01
      • 2018-02-06
      • 1970-01-01
      相关资源
      最近更新 更多