Bootstrap FreeKB - GitHub Actions - Resolve "fatal: could not read Username for 'https://github.com': No such device or address"
GitHub Actions - Resolve "fatal: could not read Username for 'https://github.com': No such device or address"

Updated:   |  GitHub Actions articles

Let's say something like this is being returned in one of your GitHub Actions workflows.

fatal: could not read Username for 'https://github.com': No such device or address
Error: Process completed with exit code 1.

 

For example, I got this when attempting to run the git pull command.

name: my workflow
run-name: ${{ github.workflow }} run by ${{ github.actor }}
on:
  workflow_dispatch:
jobs:
  my-job:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout this repo
        uses: actions/checkout@v5

      - name: git pull
        run: git pull

 

I was able to resolve this by including a GitHub token when cloning the repository and then attempting a git command such as git pull.

name: my workflow
run-name: ${{ github.workflow }} run by ${{ github.actor }}
on:
  workflow_dispatch:
jobs:
  my-job:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout this repo
        uses: actions/checkout@v5
        with:
          token: ${{ secrets.MY_TOKEN }}        

      - name: git pull
        run: git pull
        env:
          GH_TOKEN: ${{ secrets.MY_TOKEN }}         

 

Additionally, you may need to create the /home/<username>/.gitconfig file in the runner VM with the following.

[credential "https://github.com"]
        helper =
        helper = !/usr/bin/gh auth git-credential

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 6de1c7 in the box below so that we can be sure you are a human.