【问题标题】:Cloning submodule from a git bundle using the .gitmodules file使用 .gitmodules 文件从 git 包中克隆子模块
【发布时间】:2022-01-04 09:22:27
【问题描述】:

我已经捆绑了一个 repo 并将 repo.bundle 文件存储在我的文件系统上。我需要从这个包中克隆为另一个 repo 中的子模块,该 repo 当前有一个带有远程 url 的 .gitmodules 文件。为了从存储在我系统本地的 git 包进行克隆,我对我的 .gitmodules 文件进行了以下更改:

[submodule "myrepo_path/submodule_path"]
    path = myrepo_path/submodule_path
    url = file:///home/myuser/MY-BUNDLES/repo.bundle
    fetch = +refs/heads/*:refs/remotes/origin/*
    ignore = all

但是,当我执行 git submodule init 时,克隆失败并出现以下错误:

$ git submodule update --init
Cloning into '/home/myuser/Desktop/Repos/myrepo_path/submodule_path'...
fatal: too large to be a .git file: '/home/myuser/MY-BUNDLES/repo.bundle'
fatal: Could not read from remote repository.

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

捆绑包是一个 1.9G 的文件。我想知道是否可以以上述方式初始化我的子模块?或者对我来说唯一的选择是使用 git clone 命令从 git 包中显式克隆

【问题讨论】:

    标签: git git-submodules git-bundle


    【解决方案1】:

    我可以通过更改 .gitmodules 文件中的 url 使其工作。而不是

    url = file:///home/myuser/MY-BUNDLES/repo.bundle
    

    使用以下内容(摆脱file):

    url = /home/myuser/MY-BUNDLES/repo.bundle
    

    现在使用 git submodule update --init 克隆子模块

    【讨论】:

      猜你喜欢
      • 2012-06-30
      • 1970-01-01
      • 1970-01-01
      • 2012-07-06
      • 1970-01-01
      • 1970-01-01
      • 2014-10-01
      • 1970-01-01
      • 2013-06-30
      相关资源
      最近更新 更多