Skip to content

fatal: not a git repository #1697

@haosenge

Description

@haosenge

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!

Link to GitHub repository

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions