question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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:

name: "Dev Deploy"
on:
  workflow_run:
    workflows: ["Versioning"]
    types: [completed]
jobs:
  fail_job:
    runs-on: ubuntu-latest
    steps:
      - name: Fail
        run: |
          exit 1
  rollback-on-failure:
    runs-on: ubuntu-latest
    needs: [fail_job]
    if: always() && needs.fail_job.result == 'failure'
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          token: ${{ secrets.WORKFLOW_TOKEN }}
      - run: chmod +x environment/rollback.sh && ./environment/rollback.sh

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:19
  • Comments:19

github_iconTop GitHub Comments

19reactions
MichaIngcommented, Jun 10, 2022

Another hint: The PAT must have an expiry date, otherwise the same error appears 😅.

14reactions
MikulasMascautanucommented, Feb 9, 2022

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:

     - name: Checkout the private repo in which the workflow lives
        uses: actions/checkout@v2
      - name: Checkout a public repo to see if it works
        uses: actions/checkout@v2.3.4
        with:
          repository: actions/checkout
          ref: main
      - name: Checkout another private repo in the same organisation
      (and provide a PAT with repo, read:user and user:email permissions)
        uses: actions/checkout@v2.3.4
        with:
          repository: org/private-repo
          ref: master
          token: $MY_PAT

Results: Checkout the private repo in which the workflow lives ✔️ Checkout a public repo to see if it works ✔️ Checkout another private repo in the same organisation

The error: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

go get results in 'terminal prompts disabled' error for github ...
Don't do this on Windows. I ended up with error git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. .
Read more >
could not read Username for 'https://github.com': terminal ...
Getting a fatal error that looks to be the result of permission issues involving git. Configuration (MUST fill this out):. vim-go version:.
Read more >
Today I Learned — Fix for “Fatal: could not read Username for ...
fatal : could not read Username for 'https://gitlab.companyname.com': terminal prompts disabled. There are a couple of solutions to this ...
Read more >
Fatal: Could Not Read Username for 'https://github.com'
Fatal : could not read Username for 'https://github.com': terminal prompts disabled error is frustrating. Click here to learn the best solutions.
Read more >
Fatal: could not read Username for 'https://github ... - Streamlit
[manager] Cloning into 'streamlit-test'... fatal: could not read Username for 'https://github.com': terminal prompts disabled
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found