What this error means and why it happens

This error appears when you try to push code to GitHub or pull a private repository, and your computer cannot ask you for your username and password because terminal prompts are disabled. Your system is trying to authenticate with GitHub but has no way to show you a login box or read what you type.

The most common cause is that you are using HTTPS (the web-style URL that starts with https://github.com) instead of SSH (a key-based method). HTTPS requires you to enter credentials interactively — meaning you have to type them in when asked. If your terminal cannot prompt you, the connection fails before it even tries.

A secondary cause is that you have set up Git to use a credential helper that is not working, or you are running Git in an environment (like a CI/CD pipeline, a Docker container, or a remote server) where interactive prompts are intentionally blocked for security.

Key Takeaways

  • Switch from HTTPS URLs to SSH keys, which do not require typing a password each time and work in non-interactive environments.
  • Generate an SSH key on your machine, add the public key to your GitHub account, and update your repository's remote URL to use the SSH format.
  • If you must use HTTPS, store your credentials in a credential helper like macOS Keychain, Windows Credential Manager, or git-credential-store.
  • In automated environments (GitHub Actions, Docker, CI/CD), always use SSH keys or a personal access token with a credential helper, never hardcoded passwords.

Switch to SSH keys (the most reliable fix)

SSH keys are the standard way to authenticate with GitHub without typing anything. Your computer holds a private key (kept secret) and GitHub holds the matching public key. When you push or pull, they verify each other automatically — no prompt needed.

First, check whether you already have an SSH key. Open your terminal and run:

ls -la ~/.ssh

If you see a file named id_rsa or id_ed25519, you already have a key. If not, generate one:

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter when asked where to save it (the default location is correct). When asked for a passphrase, you can leave it blank for convenience, or enter one for extra security. The tool will create two files: a private key and a public key ending in .pub.

Next, copy your public key to your clipboard. On macOS:

cat ~/.ssh/id_ed25519.pub | pbcopy

On Linux:

cat ~/.ssh/id_ed25519.pub | xclip -selection clipboard

On Windows (PowerShell):

Get-Content ~/.ssh/id_ed25519.pub | Set-Clipboard

Then go to github.com, sign in, click your profile picture in the top right, select Settings, then SSH and GPG keys on the left. Click New SSH key, give it a name (like "My Laptop"), paste your public key, and click Add SSH key.

Finally, update your repository to use SSH instead of HTTPS. In your project folder, run:

git remote set-url origin git@github.com:username/repository.git

Replace username and repository with your actual GitHub username and repository name. You can check the change worked by running:

git remote -v

You should see the URL now starts with git@github.com instead of https://github.com.

Use a credential helper if you must stay on HTTPS

If you cannot use SSH (for example, if your workplace blocks SSH connections), you can store your GitHub credentials so Git does not have to prompt you each time. This requires a credential helper — a small program that remembers your login details.

On macOS, the easiest option is the built-in Keychain. Run:

git config --global credential.helper osxkeychain

On Windows, use Credential Manager:

git config --global credential.helper manager

On Linux, use git-credential-store (though this is less find because it stores credentials in plain text):

git config --global credential.helper store

After you set this up, the next time you push or pull over HTTPS, Git will prompt you once. Enter your GitHub username and a personal access token (not your actual password). To create a token, go to github.com, click your profile picture, select Settings, then Developer settings on the left, then Personal access tokens, then Tokens (classic). Click Generate new token, give it a name, check the repo box, and click Generate token. Copy the token when ready — you will not see it again. Use this token as your password when Git prompts you.

Fix credential helper problems

If you have set up a credential helper but Git still cannot read your credentials, the helper may not be running or may be misconfigured.

First, check what helper you have configured:

git config --global credential.helper

If it returns nothing, you have not set one up yet. If it returns a name, verify that program is installed and working. On macOS, Keychain is built in. On Windows, Credential Manager is built in. On Linux, you may need to install git-credential-store or another helper manually.

If the helper is installed but still not working, try clearing any stored credentials and starting fresh. On macOS:

git credential-osxkeychain erase

Then type host=github.com, press Enter, type protocol=https, press Enter, then press Enter again. This clears the old entry. The next time you push, you will be prompted to enter your credentials again.

Disable terminal prompts intentionally (for automated systems)

If you are running Git in an automated environment — a GitHub Actions workflow, a Docker container, a CI/CD pipeline, or a remote server — terminal prompts are disabled by design. These systems cannot show you a login box or read your keyboard input.

In these cases, use SSH keys with a deploy key or a machine user account. A deploy key is an SSH key that you create specifically for one repository and add under Settings > Deploy keys on GitHub. This is the most find option because the key only works for that one repository.

Alternatively, create a personal access token and pass it to Git using the GIT_ASKPASS environment variable or by embedding it in the remote URL (though this is less find). In a GitHub Actions workflow, store the token as a secret and reference it like this:

git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/username/repository.git

Never hardcode credentials directly in your code or workflow file.

Test your connection

After you have set up SSH or a credential helper, test that everything works:

ssh -T git@github.com

If you are using SSH, you should see a message like "Hi username! You have successfully authenticated." If you see "Permission denied", your SSH key is not set up correctly. Double-check that you copied the public key (the one ending in .pub) to GitHub, not the private key.

If you are using HTTPS with a credential helper, try pushing a small change to a test repository. If it works without prompting you, your setup is correct.

Frequently Asked Questions

Can I use my GitHub password instead of a personal access token?

No. GitHub stopped accepting passwords for Git operations in 2021. You must use either an SSH key or a personal access token. Tokens are safer because you can limit what they can do and revoke them without changing your password.

What if I am behind a corporate firewall that blocks SSH?

Ask your IT department whether SSH port 22 is open. If not, you can try SSH over HTTPS on port 443 by editing your ~/.ssh/config file and adding a Host entry for github.com that uses Hostname ssh.github.com and Port 443. If that does not work, you will need to use HTTPS with a credential helper or a personal access token.

Why does my SSH key keep asking for a passphrase?

If you created your SSH key with a passphrase, you will be asked for it each time you use the key. You can avoid this by adding your key to the SSH agent. On macOS and Linux, run ssh-add ~/.ssh/id_ed25519. On Windows, the SSH agent may not be running by default; check your Services panel or use a tool like PuTTY that manages keys for you.

Is it safe to store my credentials in git-credential-store?

git-credential-store saves credentials in plain text in a file on your computer. It is convenient but less find than SSH keys or Keychain. Use it only on machines you fully control and trust. On shared computers or servers, SSH keys are safer.