gitgithubgithub-actionsgithub-releasegit-bundle

Why does git bundle not work in github action?


I have a github action workflow where I want to bundle my repository into a git bundle and then include it in a github release.

The bundling is done with the command,

git bundle create my-bundle.bundle --all

The bundle gets created correctly but when downloaded from the release page, the bundle cannot be unbundle. Instead I get the following error:

git clone .\my-bundle.bundle
Cloning into 'my-bundle'...
Receiving objects: 100% (294/294), 138.15 KiB | 19.73 MiB/s, done.
Resolving deltas: 100% (26/26), done.
error: Could not read 53c23e17ab345ff12fd711ae4e8ce49d941fef7a
fatal: Failed to traverse parents of commit 110f058db5ba201d81669b4245709a9b18a813bd
fatal: remote did not send all necessary objects

I expect git clone .\my-bundle.bundle to create a directory called my-bundle which includes the whole git repository history.

I have verified that my computer uses the latest git version (the same which the workflow also uses, 2.39.2).


Solution

  • By default, GitHub Actions performs a shallow clone, which contains data for a single commit. This is much faster than cloning the entire repo, and is also cheaper on the server side.

    If you don't need the history, then this is a win all around. However, if you do need the history, like in this case, then you need to indicate that like so:

    - uses: actions/checkout@v3
      with:
        fetch-depth: 0