github actions fatal: could not read Username for 'https://github.com': No such device or address

11 min read

This error message usually occurs when the git command cannot authenticate or access the remote GitHub repository. Here are a few solutions you can try:

  1. Check the repository URL: Confirm that the repository URL is correct and accessible. Ensure that the repository is available and your internet connection is stable.

  2. Double-check your credentials: If you're using a password-protected repository, make sure you've entered the correct username and password. You could try removing the existing Git credentials from your system and re-entering them.

To remove the existing Git credentials on your local machine, execute the following command in the terminal:

git config --global --unset-all credential.helper
  1. Use SSH authentication: Instead of using HTTPS, you can set up SSH authentication for your repository. This involves generating an SSH key pair and adding the public key to your GitHub account. Then, you can change the repository URL to use the SSH format.

To generate an SSH key pair and set up SSH authentication, follow the GitHub guide here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh

To change the repository URL to SSH, execute the following command in the terminal:

git remote set-url origin [email protected]:USERNAME/REPOSITORY.git

Replace USERNAME with your GitHub username and REPOSITORY with the actual repository name.

  1. Check for token/credentials availability: If you're using GitHub API tokens or other credentials, ensure that they're correctly stored in the GitHub Actions workflow. Double-check that any required secrets or environment variables are appropriately configured.

These solutions cover some common causes of the error message you mentioned. If the problem persists, double-check your configuration and consult the GitHub Actions documentation for more detailed troubleshooting steps.