Skip to content

Commit d5c795f

Browse files
committed
doc: Add workaround for ownership on self-hosted runners
Relate-to: actions#1048 (comment) Origin: actions#2124 Signed-off-by: Philippe Coval <rzr@users.sf.net>
1 parent 85e6279 commit d5c795f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Diff for: README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,29 @@ jobs:
314314

315315
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
316316

317+
## Post checkout permission check
318+
319+
```yaml
320+
on: push
321+
jobs:
322+
build:
323+
runs-on: ubuntu-latest
324+
steps:
325+
- uses: actions/checkout@v4
326+
run: >-
327+
git status
328+
|| git config --system --add safe.directory "$GITHUB_WORKSPACE"
329+
```
330+
331+
This check prevent/workaround "fatal: detected dubious ownership in repository" error on self hosted runners.
332+
317333
# Recommended permissions
318334

319335
When using the `checkout` action in your GitHub Actions workflow, it is recommended to set the following `GITHUB_TOKEN` permissions to ensure proper functionality, unless alternative auth is provided via the `token` or `ssh-key` inputs:
320336

321337
```yaml
322338
permissions:
323-
contents: read
339+
contents: read
324340
```
325341

326342
# License

0 commit comments

Comments
 (0)