-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: fatal: could not read Username for 'https://github.com': terminal prompts disabled #664
Comments
I'm having similar issues. Did you ever find a fix @jason-ausmus? My workflow:
|
same issue here with a PAT |
@adamevers surprisingly it did start working for me when I added the |
I'm also experiencing the same issue. I wanted to add a checkout of another private repo, that lives in the same organisation as the original private repo which the workflow is in. My code:
Results: |
@MikulasMascautanu Were you able to fix this issue ? If yes, please do share. thank you |
I stumbled into the same error message and found this issue. However in my case, the cause of the problem was that the token expired. 😅 |
Another hint: The PAT must have an expiry date, otherwise the same error appears 😅. |
Has anyone found a solution to this issue? I have the same error and nothing seems to work |
Hi, sorry for my late response. |
You definitely use a PAT which has an expiry date and is not expired? |
Thanks, I think the same, I will change my strategy. :) |
@MichaIng |
@MichaIng Is the PAT something you generate yourself? Or is that the same access token we can reference with ${{secrets.GH_TOKEN}} |
The "Personal Access Token" is what you need to create yourself in your account's developer settings. In my case, AFAIK, it was required for a workflow to checkout and push to a branch/PR created by dependabot, which didn't work with the default GitHub actions token. |
I needed to auto-create a release for my private golang repository, and came across this page in my investigations. Being new to github actions and workflows, I needed to resolve how to inject |
Using a token that doesn't expire fixed this issue for me. Could someone explain if there is some underlying reason why these tokens are rejected though? If GitHub is going to reject tokens that don't expire then they shouldn't let you generate them in the first place. |
@ScottG489 - have a look at this blog post. Seems there are 3 requirements for a valid token applied in actions.
|
I had somewhat the same issue. I just removed the token.
Hope it helps someone :) |
For a simple checkout indeed no PAT is required. |
my 2 cents: it would be great that github checkout action automatically detect this kind of error return to provide a tips on this: (example: I think in many case this is just "private" + "expired" or "wrong" PAT configuration? |
@boly38 good idea. I was also very confused by the message, but ultimately I juts had the token not configured |
Should the requirement to have an expiration date in the PAT be documented here? |
I'm having the same problem as MikulasMascautanu, but I don't think there's anything wrong with my PAT. I'm only getting this error on one private repo in the entire organization. Every other repo in the same organization is completing its actions just fine, and they all use an identical CI yaml (the only difference being that this one specifies a working directory). Is there some repo setting in Github that I might need to change? |
Personally I didn't have a PAT in my GitHub workflow and it worked fine till 2 weeks ago for simple checkout, so not sure what happened on GitHub side here. |
Looks like I found the root cause of this behavior. |
@alexey-berdyugin Interesting! Could I please see an example of how you configured this? I saw this post which is making me scared to try it ! |
In my case:
|
Works for me with |
I had the same error on multiple repositories. Tried checkout@v3 and v4, but result was the same. For me, replacing the Action secret in each repository with a new Personal Access Token (with expiration) solved it. |
I had the strange case where repeating the failed job(s) after updating the PAT did not work (resulting in the same error). Finally it did work when I re-triggered the same workflow with an empty amended commit. Are secrets somehow hardcoded once a workflow/job is triggered, so that re-runs do not get changed secrets (and variables)? |
I'm having the same issues, inconsistent failures on checkout with a PAT. |
Setting this before the action solved the issue:
Don't forget to hook and remove the password after checkout |
I'm using a github repo, and unless I create a personal access token, i can't pull. |
In my case the PAT was correct, but the checkout branch did not exist. What and oddly worded error message! |
None of the different workarounds and solutions worked for me. Tried the following
Nothing works for me! |
I got it working using checkout@v3 with git config --global user.name myusername
git config --global user.email myemail
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}
...git operations |
I was able to fix this by using a classic token with the permissions Cheers |
Apparently there are issues with v3 not being able to checkout with `PUSH_KEY`? actions/checkout#664
this is one of those 'why is nothing easy / the world is against me' problems. the comment from @frans-slabbekoorn fixed it for me. Thank you to others who mentioned the PAT requiring an expiry date. |
Hey, just stumbled across this, while encountering the same error message. We use a organization wide deploy key, when checking out with the
Maybe this will help someone. |
Please explain the downvotes so I can learn from it. |
I did not downvote it, but I did not find your comment very helpful either. It is potentially problematic without more context, given that people tend to just copy&paste (take over without scrutinise whether it fits to their use case) all they find. Which PAT (classic, modern, permissions?) did throw the error before? Then narrow down the minimal required change for this case. If it was not already known/commented before, then we might have another condition, everyone can check 🙂. In my case, |
Except this makes it ignore the referenced commit of the submodule, making the build non-reproducible See also #1382 |
You can pass a reference parameter to this action that holds the correct SHA you want to checkout. To do this from an action you can save it in an environment variable.
|
…or 'https://github.com': No such device or address @see: actions/checkout#664
The layers of their javascript between you and a Instead, if you add a step to your own workflow you can emit helpful action items for when errors occur and save your future self from wasting time. You can verify your Personal Access Token is not expired and has proper permissions: GitHub:
GitHub Enterprise:
So for instance:
So write a quick script to use as a step in your workflow:
|
Using action/checkout with token is broken for our usecase, implemented a workaround from: actions/checkout#664 (comment)
* Newline after contributors * Use the PAT for pushing changes correctly Using action/checkout with token is broken for our usecase, implemented a workaround from: actions/checkout#664 (comment)
Hello,
I'm attempting a rollback flow using
actions/checkout@v2
. The problem is that I need to use a PAT in order to rollback commits that change Github Workflows and when I pass that PAT into actions/checkout, I get an error.Error: fatal: could not read Username for 'https://github.com': terminal prompts disabled
My workflow:
The PAT used has the permissions to change workflows, as well as repository permissions. The issue seems to be that the action doesn't allow me to set a username before it tries to fetch the repository.
The text was updated successfully, but these errors were encountered: