Error: spawn git ENOENT
Describe the bug
When we try to add files into git (translations) we always got this error:
Error: Error: Error: spawn git ENOENT
Workflow used
- name: Add lokalise translations
uses: EndBug/add-and-commit@v9
with:
message: 'Push translations [translations skip]'
default_author: github_actions
add: 'lang'
Expected behavior Should add files and push them into the branch.
Logs

Hi, can you post the workflow used? I'm interested in the previous steps and the image that's being used by the runner
@EndBug Here is full workflow
push-translations:
name: Pull and push translations
runs-on: [hetzner,light]
container:
image: "node:18-bullseye-slim"
needs: [install]
steps:
- uses: actions/checkout@v2
- name: Restore node_modules cache
uses: actions/cache@v2
with:
path: node_modules
- name: Extract translations
run: |
yarn install
yarn translation:extract
- name: Push translations
run: |
yarn translation:push
- name: Pull translations
uses: nick-fields/retry@v2
with:
command: yarn translation:pull
- name: Compile translations
run: |
yarn translation:compile
- name: Add lokalise translations
uses: EndBug/add-and-commit@v9
with:
message: 'Push translations [translations skip]'
default_author: github_actions
add: 'lang'
Can you please make sure that the "node:18-bullseye-slim" image has git installed?
@EndBug Hey. Thanks for the suggestion. Now i got the new error.
Workflow
push-translations:
name: Pull and push translations
runs-on: [hetzner,light]
container:
image: "node:18-bullseye-slim"
needs: [install]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.REPO_TOKEN }}
- name: Ensure git is present # New changes
run: |
apt-get update -y
apt-get install git -y
- name: Restore node_modules cache
uses: actions/cache@v3
with:
path: node_modules
key: node_modules_cache-${{ hashFiles('yarn.lock') }}
restore-keys: node_modules_cache-${{ hashFiles('yarn.lock') }}
- name: Extract translations
run: |
yarn install
yarn translation:extract
- name: Push translations
run: |
yarn translation:push
- name: Pull translations
uses: nick-fields/retry@v2
with:
command: yarn translation:pull
- name: Compile translations
run: |
yarn translation:compile
- name: Add lokalise translations
uses: EndBug/add-and-commit@v9
with:
message: 'Push translations [translations skip]'
default_author: github_actions
add: 'lang'
And logs

I would try installing git before checking out the repository, so that the repository can be correctly set up
@EndBug THank you! This is helped me