toc

content

Forgejo actions/checkout encounters a 400 error during LFS checkout

The following action will fail: 1

    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          lfs: true

With the following errors reported in the log: 1

LFS: Client error: https://git.tsuki.games/exodrifter/website.git/info/lfs/objects/ef67b49026709326771be3cc8ab935eac98f1aef5f653115dfe7e12af2c89be0 error: failed to fetch some objects from 'https://git.tsuki.games/exodrifter/website.git/info/lfs' ::remove-matcher owner=checkout-git:: ::error::The process '/usr/bin/git' failed with exit code 2

This is happening because it's receiving a 400 error from the server. 1 In turn, this is happening because actions/checkout sends a malformed request containing a double auth header to the server instead of using the credential helper. To work around this problem, you need to pull the LFS files manually: 2

- uses: actions/checkout@v4
  with:
    lfs: false # Should be the default
    persist-credentials: 'true' # Optional; should be the default

- name: Checkout lfs
  run: |
    git lfs install --local
    AUTH=$(git config --local http.${{ github.server_url }}/.extraheader)
    git config --local --unset http.${{ github.server_url }}/.extraheader
    git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH"
    git lfs pull

History

meta

tags: forgejo

created: modified:

commit: ba1f8314