[GH-ISSUE #1697] fatal: not a git repository #840

Closed
opened 2026-03-01 21:46:49 +03:00 by kerem · 6 comments
Owner

Originally created by @haosenge on GitHub (Mar 25, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1697

Bug report info

act version:            0.2.43
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 10
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        /var/run/docker.sock
        /Users/hge/.docker/run/docker.sock
Config files:           
        /Users/hge/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.20.1
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.43
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               arm64
                GOOS:                 darwin
Docker Engine:
        Engine version:        20.10.22
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:            
        OS arch:               aarch64
        OS kernel:             5.15.49-linuxkit
        OS CPU:                5
        OS memory:             7851 MB
        Security options:
                name=seccomp,profile=default
                name=cgroupns

Command used with act

act push --container-architecture linux/amd64

Describe issue

I tried to test a simple Github Action workflow but ran into this "fatal: not a git repository" error constantly.

It seems that there is no ".git" folder in the container which causes all sorts of problems.

The job is just to get the changed file names but there is no commit history to be compared.

jobs:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 2

      - name: Get Changed Files
        id: changed-files
        uses: tj-actions/changed-files@v35

The workflow always stops at the following error message

| Verifying git version...
| Valid git version found: (2.40.0)
| fatal: not a git repository (or any parent up to mount point /some/path)
| Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I have tried upgrading git before running any git operations but nothing works so far. I would really appreciate some help. Thank you very much!

No response

Workflow content

name: Pull Request Pipeline
on: [push]
jobs:
    Lint-and-Checksum-Checks:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 2

      - name: Get Changed Files
        id: changed-files
        uses: tj-actions/changed-files@v35

Relevant log output

[Pull Request Pipeline/Lint-and-Checksum-Checks]   ❓  ::group::changed-files-diff-sha
[Pull Request Pipeline/Lint-and-Checksum-Checks]   💬  ::debug::Resolving repository path: /some/path/.
| Verifying git version...
| Valid git version found: (2.40.0)
| fatal: not a git repository (or any parent up to mount point /some/path)
| Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
[Pull Request Pipeline/Lint-and-Checksum-Checks]   ❗  ::error::Unable to determine if the repository is shallow
[Pull Request Pipeline/Lint-and-Checksum-Checks]   ❌  Failure - Main # "Calculating the previous and current SHA..."

Additional information

No response

Originally created by @haosenge on GitHub (Mar 25, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1697 ### Bug report info ```plain text act version: 0.2.43 GOOS: darwin GOARCH: arm64 NumCPU: 10 Docker host: DOCKER_HOST environment variable is unset/empty. Sockets found: /var/run/docker.sock /Users/hge/.docker/run/docker.sock Config files: /Users/hge/.actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.20.1 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.43 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: arm64 GOOS: darwin Docker Engine: Engine version: 20.10.22 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: aarch64 OS kernel: 5.15.49-linuxkit OS CPU: 5 OS memory: 7851 MB Security options: name=seccomp,profile=default name=cgroupns ``` ### Command used with act ```sh act push --container-architecture linux/amd64 ``` ### Describe issue I tried to test a simple Github Action workflow but ran into this "fatal: not a git repository" error constantly. It seems that there is no ".git" folder in the container which causes all sorts of problems. The job is just to get the changed file names but there is no commit history to be compared. ``` jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v3 with: fetch-depth: 2 - name: Get Changed Files id: changed-files uses: tj-actions/changed-files@v35 ``` The workflow always stops at the following error message ``` | Verifying git version... | Valid git version found: (2.40.0) | fatal: not a git repository (or any parent up to mount point /some/path) | Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). ``` I have tried upgrading git before running any git operations but nothing works so far. I would really appreciate some help. Thank you very much! ### Link to GitHub repository _No response_ ### Workflow content ```yml name: Pull Request Pipeline on: [push] jobs: Lint-and-Checksum-Checks: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v3 with: fetch-depth: 2 - name: Get Changed Files id: changed-files uses: tj-actions/changed-files@v35 ``` ### Relevant log output ```sh [Pull Request Pipeline/Lint-and-Checksum-Checks] ❓ ::group::changed-files-diff-sha [Pull Request Pipeline/Lint-and-Checksum-Checks] 💬 ::debug::Resolving repository path: /some/path/. | Verifying git version... | Valid git version found: (2.40.0) | fatal: not a git repository (or any parent up to mount point /some/path) | Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). [Pull Request Pipeline/Lint-and-Checksum-Checks] ❗ ::error::Unable to determine if the repository is shallow [Pull Request Pipeline/Lint-and-Checksum-Checks] ❌ Failure - Main # "Calculating the previous and current SHA..." ``` ### Additional information _No response_
kerem 2026-03-01 21:46:49 +03:00
Author
Owner

@MatteoGioioso commented on GitHub (Apr 12, 2023):

Have you tried this workaround? https://github.com/actions/checkout/issues/363#issuecomment-1163942488

For me it did not work, I am trying to establish whether it is a bug in act or in checkoutv2

<!-- gh-comment-id:1504612255 --> @MatteoGioioso commented on GitHub (Apr 12, 2023): Have you tried this workaround? https://github.com/actions/checkout/issues/363#issuecomment-1163942488 For me it did not work, I am trying to establish whether it is a bug in act or in checkoutv2
Author
Owner

@haosenge commented on GitHub (Apr 13, 2023):

actions/checkout#363 (comment)

Yes, I have tried that. But it didn't work for me either.

<!-- gh-comment-id:1507680613 --> @haosenge commented on GitHub (Apr 13, 2023): > actions/checkout#363 (comment) Yes, I have tried that. But it didn't work for me either.
Author
Owner

@ceciliacsilva commented on GitHub (Jun 9, 2023):

I have the same problem. The workaround described above https://github.com/actions/checkout/issues/363#issuecomment-1163942488 worked on the remote CI but it didn't work with locally act.

<!-- gh-comment-id:1584565361 --> @ceciliacsilva commented on GitHub (Jun 9, 2023): I have the same problem. The workaround described above https://github.com/actions/checkout/issues/363#issuecomment-1163942488 worked on the `remote CI` but it didn't work with locally `act`.
Author
Owner

@github-actions[bot] commented on GitHub (Dec 7, 2023):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1843914816 --> @github-actions[bot] commented on GitHub (Dec 7, 2023): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@CEbbinghaus commented on GitHub (Sep 2, 2024):

Unfortunate that this issue was marked as stale was closed given that its still a problem. Just started happening to me.

Edit: In my case it was forgetting that the checkout action was gated behind if: !{{env.ACT}}. I think checkout used to not work in old versions of ACT and it would just copy the current directory but it seems to work fine once that is removed.

<!-- gh-comment-id:2324412808 --> @CEbbinghaus commented on GitHub (Sep 2, 2024): Unfortunate that this issue was marked as stale was closed given that its still a problem. Just started happening to me. Edit: In my case it was forgetting that the checkout action was gated behind `if: !{{env.ACT}}`. I think checkout used to not work in old versions of ACT and it would just copy the current directory but it seems to work fine once that is removed.
Author
Owner

@gastmaier commented on GitHub (Mar 17, 2025):

On my side it was .gitignore .* rule, due to --use-gitignore Controls whether paths specified in .gitignore should be copied into container (default true)

<!-- gh-comment-id:2729018974 --> @gastmaier commented on GitHub (Mar 17, 2025): On my side it was .gitignore ```.*``` rule, due to``` --use-gitignore Controls whether paths specified in .gitignore should be copied into container (default true)```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#840
No description provided.