|
| 1 | +id: runner-environment-498 |
| 2 | +title: 'actions/checkout@v6 Persisted Credentials Not Available Inside Subsequent Docker Container Actions' |
| 3 | +category: runner-environment |
| 4 | +severity: error |
| 5 | +tags: |
| 6 | + - checkout |
| 7 | + - checkout-v6 |
| 8 | + - docker |
| 9 | + - container-action |
| 10 | + - credentials |
| 11 | + - git-auth |
| 12 | + - persist-credentials |
| 13 | + - v6-regression |
| 14 | +patterns: |
| 15 | + - regex: 'fatal: could not read Username for .https://github\.com.: terminal prompts disabled' |
| 16 | + flags: 'i' |
| 17 | + - regex: 'fatal: repository .https://github\.com/.*?. not found' |
| 18 | + flags: 'i' |
| 19 | + - regex: 'remote: Repository not found\.' |
| 20 | + flags: 'i' |
| 21 | + - regex: 'Authentication failed for .https://github\.com' |
| 22 | + flags: 'i' |
| 23 | +error_messages: |
| 24 | + - "fatal: could not read Username for 'https://github.com': terminal prompts disabled" |
| 25 | + - "remote: Repository not found." |
| 26 | + - "fatal: repository 'https://github.com/<org>/<repo>/' not found" |
| 27 | + - "Error: Authentication failed for 'https://github.com/'" |
| 28 | +root_cause: | |
| 29 | + actions/checkout@v6 introduced a new credential persistence mechanism that requires |
| 30 | + runner v2.329.0+. In this design the checkout action stores git credentials via the |
| 31 | + runner's credential-store rather than writing to the container's filesystem, enabling |
| 32 | + persistent access across steps. |
| 33 | +
|
| 34 | + However, subsequent DOCKER CONTAINER ACTIONS run inside an isolated container |
| 35 | + filesystem that does not mount or inherit the host runner's credential store. Git |
| 36 | + operations inside a Docker container action that attempt to authenticate against |
| 37 | + GitHub will fail because: |
| 38 | +
|
| 39 | + 1. The credential helper configured by checkout@v6 points to a host-side file or |
| 40 | + socket that is not mounted inside the container. |
| 41 | + 2. The container's git has no fallback credentials and interactive prompts are |
| 42 | + disabled in CI (GIT_TERMINAL_PROMPT=0). |
| 43 | + 3. Even with persist-credentials: true (the default), the container cannot read |
| 44 | + the stored credentials. |
| 45 | +
|
| 46 | + The v6-beta release notes stated that Docker container action support would be |
| 47 | + available from runner v2.329.0+, but this was not fully implemented as of June 2026. |
| 48 | + This is an open upstream bug (actions/checkout#2359). |
| 49 | +fix: | |
| 50 | + Downgrade to actions/checkout@v4 in any workflow that includes Docker container |
| 51 | + actions that require git access. checkout@v4 stores credentials in ~/.git-credentials |
| 52 | + on the host filesystem, which IS accessible to Docker container actions via the |
| 53 | + default workspace mount. |
| 54 | +
|
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v4 # v4 credentials are accessible to Docker container actions |
| 57 | + with: |
| 58 | + fetch-depth: 0 |
| 59 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + persist-credentials: true |
| 61 | +
|
| 62 | + If v6 is required, pass the token to the Docker container action explicitly as an |
| 63 | + environment variable and configure git inside the container manually. |
| 64 | +fix_code: |
| 65 | + - language: yaml |
| 66 | + label: Downgrade to checkout@v4 when workflow uses Docker container actions |
| 67 | + code: | |
| 68 | + steps: |
| 69 | + # v4 stores credentials in ~/.git-credentials accessible to Docker containers |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v4 |
| 72 | + with: |
| 73 | + fetch-depth: 0 |
| 74 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + persist-credentials: true |
| 76 | +
|
| 77 | + # Docker container action can now access git credentials |
| 78 | + - name: Run Docker container action |
| 79 | + uses: org/docker-container-action@v1 |
| 80 | + with: |
| 81 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + - language: yaml |
| 83 | + label: Pass token explicitly to Docker container action (v6 workaround) |
| 84 | + code: | |
| 85 | + steps: |
| 86 | + - name: Checkout |
| 87 | + uses: actions/checkout@v6 |
| 88 | + with: |
| 89 | + persist-credentials: false # disable v6 mechanism |
| 90 | +
|
| 91 | + # Manually configure credentials accessible inside the container |
| 92 | + - name: Configure git credentials |
| 93 | + run: | |
| 94 | + git config --global credential.helper store |
| 95 | + echo "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com" \ |
| 96 | + >> ~/.git-credentials |
| 97 | +
|
| 98 | + - name: Run Docker container action |
| 99 | + uses: org/docker-container-action@v1 |
| 100 | +prevention: |
| 101 | + - "Check the release notes before upgrading checkout versions in workflows that include Docker container actions." |
| 102 | + - "Pin checkout to @v4 in workflows that use Docker container actions until actions/checkout#2359 is resolved." |
| 103 | + - "After upgrading checkout versions, verify end-to-end in a test branch before rolling out to all workflows." |
| 104 | + - "Track actions/checkout#2359 for the upstream fix and re-evaluate once it ships." |
| 105 | +docs: |
| 106 | + - url: "https://github.com/actions/checkout/issues/2359" |
| 107 | + label: "actions/checkout issue #2359 — v6 credentials don't work with Docker container actions" |
| 108 | + - url: "https://github.com/actions/checkout/releases/tag/v6.0.0" |
| 109 | + label: "actions/checkout v6 release notes" |
| 110 | + - url: "https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-docker-container-action" |
| 111 | + label: "GitHub Docs — Creating a Docker container action" |
0 commit comments