Skip to content

/github/home/.gitconfig does not exist for container runs #1169

@arbourd

Description

@arbourd

Issue

If running a job that uses a container like the below, the file /github/home/.gitconfig will not exist, even after checkout runs a config command.

  example:
    runs-on: ubuntu-latest
    container:
      image: alpine

Here is a demo:

  1. Checkout runs, and runs /usr/bin/git config --global --add safe.directory /__w/sat/sat
  2. The global .gitconfig does not exist
  3. Any calls to git remain unsafe/dubious

The safe.directory settings set by the command git config --global --add safe.directory <path> is a no-op.

Workaround

Use the --system scope over --global:

$ git config --system --add safe.directory <path>
  example:
    runs-on: ubuntu-latest
    container:
      image: alpine

    steps:
      - uses: actions/checkout@v3
      - run: git config --system --add safe.directory <path>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions