checkout icon indicating copy to clipboard operation
checkout copied to clipboard

git-lfs cannot be found in a self-hosted runner

Open fengwang opened this issue 1 year ago • 1 comments

Steps to reproduce

  1. Install actions-runner-linux-x64-2.299.2 in Archlinux/Ubuntu1804, setup token and service
  2. Create an action script in folder .github/workflows including
name: CI

on:
  push:
    branches: [ "main", "workflow" ]
  pull_request:
    branches: [ "main", "workflow" ]


jobs:

  build:
    runs-on: self-hosted

    steps:
      - name: cleanup
        run: |
          echo Will clean from here.
          echo $PATH
          whoami
          echo Clean is skipped.
          which git
          uname -a
          which apt
          echo $PATH

      - uses: actions/checkout@v3
        with:
          lfs: true
          submodules: 'recursive'
          token: ${{ secrets.ACCESS_TOKEN }}

        env:
          GIT_CURL_VERBOSE: '1'
          GIT_TRACE: '1'

I encountered build error with message

[build](https://github.xxxxxxxx.com/xxxxxx/XXXXXXXXXX/actions/runs/396556/jobs/633216#step:3:23)
Unable to locate executable file: git-lfs. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

The cleanup step produces information like this:

Run echo Will clean from here.
Will clean from here.
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
azureuser
Clean is skipped.
/usr/bin/git
Linux AIC-GithubActionsRunner 5.[1](https://github.xxx.com/xxxxxx/XXXXXXXX/actions/runs/396556/jobs/633216#step:2:1)5.0-1033-azure #40~20.04.1-Ubuntu SMP Tue Jan 24 [16](https://github.xxxxxxxx.com/xxxxxx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/actions/runs/396556/jobs/633216#step:2:17):06:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
/usr/bin/apt
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

The checkout step produces error information

Run actions/checkout@v3
Syncing repository: XXXXXXXX/xxxxxxxx
Getting Git version info
  Working directory is '/home/azureuser/actions-runner/_work/XXXXXXXX/XXXXXXXX'
  /usr/bin/git version
  [20](https://github.xxxxxxxxxx.com/xxxxxx/XXXXXXXX/actions/runs/396556/jobs/633216#step:3:21):09:09.676113 git.c:439               trace: built-in: git version
  git version 2.25.1
  Error: Unable to locate executable file: git-lfs. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

Note:

  1. XXXXXXX and xxxxxx are sensitive information get masked
  2. git-lfs is already installed and configured in the host system (ArchLinux/Ubuntu 1804)

fengwang avatar Jul 04 '23 20:07 fengwang