Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Remote "origin" does not support the Git LFS locking API #485

Closed
1 task done
kdeldycke opened this issue Mar 4, 2024 · 4 comments · Fixed by #498
Closed
1 task done

[Bug]: Remote "origin" does not support the Git LFS locking API #485

kdeldycke opened this issue Mar 4, 2024 · 4 comments · Fixed by #498
Assignees
Labels
bug Something isn't working

Comments

@kdeldycke
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

While searching for a workaround for #467, I was unable to continue working on the branch produced by actions-template-sync because of LFS.

Expected Behavior

I expect LFS to be not be activated by default for repository not configured for it.

Current Behavior

The following job:

  awesome-template-sync:
    name: Sync awesome template
    if: >
      startsWith(github.event.repository.name, 'awesome-')
      && github.event.repository.name != 'awesome-template'
    runs-on: ubuntu-22.04
    steps:

      - uses: actions/checkout@v4.1.1
        with:
          # We need custom PAT with workflows permissions so we can update all the boilerplate .github files from
          # awesome-template.
          token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }}

      - name: Sync from template repo
        id: template_sync
        uses: AndreasAugustin/actions-template-sync@v1.8.1
        with:
          # We need custom PAT with workflows permissions so we can update all the boilerplate .github files from
          # awesome-template.
          github_token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }}
          source_repo_path: kdeldycke/awesome-template
          pr_title: "[sync] Updates from `awesome-template` repository"
          pr_commit_msg: "[sync] Updates from `awesome-template` repository"
          pr_branch_name_prefix: "sync-awesome-template"
          pr_labels: "📚 documentation"
          is_pr_cleanup: true

      - name: Print PR branch ID
        run: |
          echo "PR branch ID: ${{ steps.template_sync.outputs.pr_branch }}"

      - name: Checkout template sync PR
        uses: actions/checkout@v4.1.1
        with:
          ref: ${{ steps.template_sync.outputs.pr_branch }}
          # We need custom PAT with workflows permissions so we can update all the boilerplate .github files from
          # awesome-template.
          token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }}

      - name: List commits
        run: |
          git log

      - name: Update repo URLs
        # Replace "/kdeldycke/awesome-template/" in URLs by "/kdeldycke/awesome-<repo_id>/".
        run: >
          find ./.github/ -type f -iregex '.*\.\(md\|yaml\)$' -print -exec sed -i
          "s/\/kdeldycke\/awesome-template\//\/kdeldycke\/${{ github.event.repository.name }}\//g" "{}" \;

      - name: Show diff
        run: |
          git diff

      - name: Setup Git
        run: |
          git config --global user.name "${{ github.actor }}"
          git config --global user.email "${{ github.actor }}@users.noreply.github.com"

      - name: Show diff
        run: |
          git commit --all -m 'Update URLs'

      - run: >
          git push

Ends up with the following error at the last git push step:
Screenshot 2024-03-04 at 15 03 11

Log of the workflow run is available at: https://github.com/kdeldycke/awesome-billing/actions/runs/8123005442/job/22202990790

Steps To Reproduce

No response

Possible Solution

A quick fix in my case was to hack the local git configuration with a dedicated step:

      - name: Deactivate LFS
        run: |
          git config lfs.https://github.com/kdeldycke/${{ github.event.repository.name }}.git/info/lfs.locksverify false

Additional Information/Context

LFS support was introduced in:

Template sync version Version

1.8.1

@kdeldycke kdeldycke added the bug Something isn't working label Mar 4, 2024
@AndreasAugustin
Copy link
Owner

Hi @kdeldycke and thanks for the report.
Hmm actually back in time I was thinking about using a input parameter for enabling git lfs. Thought there is no issue doing per default. Seems I was wrong on that 🥷

I do not fully understand the issue because github is supporting git lfs (at least the public one, not sure if every enterprise server is supporting git lfs)

Remark
Actually not an issue related to git lfs, but possibly solvable:
you are also using a step

      - name: Setup Git
        run: |
          git config --global user.name "${{ github.actor }}"
          git config --global user.email "${{ github.actor }}@users.noreply.github.com"

possibly removing --global within src/entrypoint.sh line 75++ is a better option. I need to think about the solution and possibly check other famous github actions how they are doing the configuration.

  git config --global user.email "${GIT_USER_EMAIL}"
  git config --global user.name "${GIT_USER_NAME}"
  git config --global pull.rebase false
  git config --global --add safe.directory /github/workspace
  git lfs install

@AndreasAugustin
Copy link
Owner

Remark:
#498 will solve this issue. The PR need some more testing and some small adjustments and checks.

@AndreasAugustin
Copy link
Owner

@kdeldycke with #498 the default behavior is to not use git lfs.
There is now a input parameter available to enable git lfs.

@kdeldycke
Copy link
Contributor Author

I can confirm that I am no longer affected by these bugs with 2.0.0 as the recent changes are deactivating LFS by default.

Thanks @AndreasAugustin for the quick bug fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants