gitgit-submodulesgit-bundle

Cloning submodule from a git bundle using the .gitmodules file


I have bundled a repo and stored the repo.bundle file on my filesystem. I need to clone from this bundle as a submodule in another repo which currently has a .gitmodules file with the remote url. In order to clone from the git bundle stored locally on my system, I made the following change to my .gitmodules file:

[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

However when I do a git submodule init, the cloning fails with the following error:

$ 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.

The bundle is a 1.9G file. I want to know if it is possible to init my submodules in the above manner? Or the only option for me is to explicitly clone from the git bundle using the git clone command


Solution

  • I could make it work by changing the url in the .gitmodules file. Instead of

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

    use the following (get rid of file):

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

    Now the submodule gets cloned on using git submodule update --init