Skip to content

actions/checkout@v6 credential auth fails when GITHUB_WORKSPACE is a symlink created by this action #296

@srz-zumix

Description

@srz-zumix

Summary

Using setup-job-workspace-action (which replaces GITHUB_WORKSPACE with a symlink) followed by actions/checkout@v6 causes a credential authentication failure with:

fatal: could not read Username for 'https://github.com/': terminal prompts disabled

Root cause

actions/checkout@v6 changed how it stores credentials (compared to v5). Instead of writing http.https://github.com/.extraheader directly into .git/config, it now writes includeIf "gitdir:..." directives that reference the credential config file:

[includeIf "gitdir:/home/runner/work/repo/repo/.git"]
    path = /home/runner/work/_temp/git-credentials-<uuid>.config

The gitdir: path is derived from GITHUB_WORKSPACE, which is a symlink after setup-job-workspace-action runs.

Git resolves symlinks when evaluating gitdir: conditions, so the resolved .git path (the real path) never matches the symlink-based path in includeIf. As a result, the credential config file is never loaded and the fetch fails.

This is tracked upstream in actions/checkout#2393.

Steps to reproduce

jobs:
  build:
    runs-on: [self-hosted]
    steps:
      - uses: DeNA/setup-job-workspace-action@v4  # GITHUB_WORKSPACE becomes a symlink here
      - uses: actions/checkout@v6                  # writes includeIf with symlink path → auth fails

Expected behavior

actions/checkout@v6 should authenticate successfully regardless of whether GITHUB_WORKSPACE is a symlink.

Actual behavior

Setting up auth
  /usr/bin/git config --local includeIf.gitdir:/home/runner/work/repo/repo/.git.path \
    /home/runner/work/_temp/git-credentials-<uuid>.config
Fetching the repository
  Error: fatal: could not read Username for 'https://github.com/': terminal prompts disabled

The gitdir: condition uses the symlink path, but git evaluates it against the real resolved path — they never match.

Workarounds

  1. Pin to actions/checkout@v5 — v5 writes credentials directly into .git/config as http.https://github.com/.extraheader, which is unaffected by symlinks.

Notes

  • The fix for actions/checkout is proposed in actions/checkout#2394 (resolve symlinks before writing gitdir: paths), but has not been released yet.
  • This action's own actions-test.yml avoids the issue by using persist-credentials: false in its integration tests, but the README examples do not mention this caveat.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions