Replies: 5 comments 10 replies
-
|
This is a known issue with 1. Explicitly pass the token (even for GITHUB_TOKEN): - uses: actions/checkout@v6
with:
token: ${{ secrets. GITHUB_TOKEN }}2. Set - uses: actions/checkout@v6
with:
token: ${{ secrets. GITHUB_TOKEN }}
persist-credentials: true3. If checking out a PR from a fork, you may need: - uses: actions/checkout@v6
with:
ref: ${{ github. event.pull_request.head.sha }} |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
This error usually happens because authentication is not being passed correctly to actions/checkout when upgrading to v6. In most cases, explicitly providing the GITHUB_TOKEN to the checkout step resolves it. For example:
Even though the token exists automatically in GitHub Actions, some workflows that worked in earlier versions relied on implicit behavior that changed between versions. Also double-check that: the workflow has permissions: contents: read the repository is not being checked out from a fork where the token may have restricted permissions no earlier step overrides the git auth configuration If the workflow worked with v5 and fails with v6, it's usually related to token propagation or auth setup during the fetch step, which results in the fatal: could not read Username error you’re seeing. |
Beta Was this translation helpful? Give feedback.
-
|
The issue happens because actions/checkout@v6 handles authentication differently than v5. In v6, you need to explicitly pass the token using token: ${{ secrets.GITHUB_TOKEN }}; otherwise, Git cannot authenticate and you get errors like fatal: could not read Username for 'https://github.com/'. Make sure your job also has permissions: contents: read. If you’re running this for a pull request from a fork, the GITHUB_TOKEN may not have access, in which case you should use persist-credentials: false and a personal access token. The key point is that v6 is stricter with authentication, so explicitly providing the token resolves the fetch failure. |
Beta Was this translation helpful? Give feedback.
-
|
I setup my job like this ... jobs:
check-root:
runs-on: my-runner
permissions:
contents: read # Required to checkout the repository
steps:
- id: repo-checkout
name: "Checkout repository"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true
token: ${{ secrets.GITHUB_TOKEN }}And the issue is the same ... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Actions Checkout
Discussion Details
Hello,
We encounter this issue with the version v6 of the checkout action. All the workflows worked well before with the v5 version.
We only want to fetch the current repository (not another one) using the GITHUB_TOKEN.
The permission of the token is set:
However the workflow is not working with the v6 version:
There are some answers here actions/checkout#664 but I would like to be sure that it's not a configuration issue ...
Beta Was this translation helpful? Give feedback.
All reactions