Skip to content

Provide human friendly message instead of fatal: --local can only be used inside a git repository #714

Open
@jsoref

Description

@jsoref

This run managed to create a .git directory containing a single file (reporter.json):

https://github.com/jsoref/examples-testing/runs/5404530182?check_suite_focus=true#step:4:20

Download action repository 'actions/checkout@v2' (SHA:ec3a7ce113134d7a93b817d10a8272cb61118579)
...
Run actions/checkout@v2
  with:
    repository: jsoref/examples-testing
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    fetch-depth: 1
    lfs: false
    submodules: false
  env:
    PR_HEAD_SHA: 2f3e6fc9852caf53e728702a7adf0e871e2e1531
    result_code: 
Syncing repository: jsoref/examples-testing
Getting Git version info
/usr/bin/git config --local --get remote.origin.url
Error: fatal: --local can only be used inside a git repository
Deleting the contents of '/home/runner/work/examples-testing/examples-testing'

Which triggers:

['config', '--local', '--get', 'remote.origin.url'],

The message:

Error: fatal: --local can only be used inside a git repository

... is not particularly helpful to most people.

In this code path, what it means is:

There was a .git directory where the checkout was trying to operate, but it wasn't a valid .git repository.

The next log output line is fine:

Deleting the contents of '/home/runner/work/examples-testing/examples-testing'

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