NeuroAgent

Fix Git Pull Authentication Error: GitHub Password Auth Removed

Learn why you're getting 'Support for password authentication was removed' error with git pull and how to fix it with proper Personal Access Token setup, credential management, and alternative authentication methods.

Question

I’m getting an error ‘Support for password authentication was removed’ when trying to use git pull, even though I recently created a GitHub personal access token that should still be valid. Why am I encountering this authentication error and how can I resolve it?

NeuroAgent

The error “Support for password authentication was removed” occurs because GitHub discontinued password authentication for Git operations on August 13, 2021, requiring Personal Access Tokens (PAT) instead. Even with a valid PAT, you might still encounter authentication issues due to token expiration, insufficient permissions, credential caching problems, or SSO requirements for organization accounts.

Contents

Understanding the Authentication Error

The “Support for password authentication was removed” error message appears because GitHub made a significant security policy change on August 13, 2021, where they completely stopped accepting account passwords for Git operations over HTTPS [source]. This change was implemented to enhance security and prevent potential password leaks in Git logs and command history.

As stated in GitHub’s official policy, “Starting from August 13, 2021, GitHub removed support for using a password to authenticate Git operations. This means that you will need to use an SSH key or a Personal Access Token (PAT) to authenticate when cloning…”

This error typically occurs when your local Git configuration still has cached credentials using your old password, or when you’re manually entering credentials and trying to use your password instead of a PAT.

Common Reasons Your Personal Access Token Isn’t Working

Even if you’ve created a PAT, several issues can prevent it from working properly with git pull:

1. Token Expiration

Personal Access Tokens have expiration dates that you set when creating them. If your token has expired, it will no longer work for authentication [source]. Tokens can expire from 1 day to 1 year depending on how you configured them initially.

2. Insufficient Permissions

Your PAT might not have the required scopes (permissions) for the operations you’re trying to perform. For basic Git operations like git pull, you need at least the repo scope which provides read access to public repositories and full control to private repositories [source].

3. Organization SSO Requirements

If you’re working with organization repositories, your PAT might require SSO (Single Sign-On) configuration. Many organizations mandate that PATs be authorized through their identity provider before use [source].

4. Credential Caching Issues

Your system might be caching old password-based credentials and not prompting you to enter your new PAT [source]. This is particularly common on Windows systems that store Git credentials in the Windows Credential Manager.

5. Incorrect Token Entry

When prompted for credentials, you need to enter your username (GitHub username) and the PAT as the password, not your actual GitHub account password [source].

Step-by-Step Solutions to Fix the Issue

Solution 1: Generate a New Personal Access Token with Proper Permissions

  1. Go to GitHub Settings: Click your profile picture in the top-right corner and select “Settings”
  2. Navigate to Developer Settings: In the left sidebar, click on “Developer settings”
  3. Create New Token: Click on “Personal access tokens” → “Tokens (classic)” → “Generate new token”
  4. Configure Token Settings:
    • Provide a descriptive note (e.g., “Git operations for repository X”)
    • Set expiration date (choose appropriate timeframe)
    • Select scopes: For git pull, you need at least repo scope [source]
  5. Copy and Store Securely: After generation, immediately copy the token and store it in a secure location

Solution 2: Configure Git Credential Manager

Configure Git to use your PAT properly by setting up credential caching:

bash
# Configure Git to use credential helper
git config --global credential.helper manager

# Or for macOS
git config --global credential.helper osxkeychain

# For Linux
git config --global credential.helper store

Solution 3: Clear Cached Credentials

Remove any cached password-based credentials:

Windows:

  1. Open Credential Manager
  2. Go to Windows Credentials
  3. Find any entries related to git:https://github.com
  4. Remove them

macOS:

bash
security delete-internet-password -a "github.com" -s "git:https://github.com"

Solution 4: Configure PAT for Organization SSO

If working with organization repositories:

  1. Ensure your PAT is authorized through your organization’s SSO
  2. Go to your organization’s settings
  3. Navigate to “Authentication” → “Require personal access token authorization for organization members”
  4. Authorize your existing PAT or generate a new one that’s SSO-enabled [source]

Solution 5: Use the PAT Correctly

When prompted for credentials during git pull:

  • Username: Your GitHub username
  • Password: Your Personal Access Token (not your GitHub account password)

You can also configure Git to remember your PAT by setting:

bash
git config --global credential.helper store

Then run your Git command, and when prompted, enter your username and PAT.

Alternative Authentication Methods

If PATs continue to cause issues, consider these more reliable alternatives:

SSH Key Authentication

SSH keys provide a more secure and often more convenient authentication method:

  1. Generate SSH Key:

    bash
    ssh-keygen -t ed25519 -C "your_email@example.com"
    
  2. Add SSH Key to SSH Agent:

    bash
    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_ed25519
    
  3. Add Public Key to GitHub:

    • Copy your public key: cat ~/.ssh/id_ed25519.pub
    • Go to GitHub Settings → SSH and GPG keys → New SSH key
    • Paste the public key content
  4. Use SSH URLs:

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

GitHub CLI Authentication

The GitHub CLI provides streamlined authentication:

bash
# Authenticate with GitHub CLI
gh auth login

# Set as credential helper
git config --global credential.helper "gh auth git-credential"

Preventing Future Authentication Issues

To avoid similar authentication problems in the future:

1. Set Appropriate Token Expirations

  • Use shorter expiration times for development tokens (30-90 days)
  • Use longer expiration times for production tokens (up to 1 year)
  • Regularly audit and rotate your tokens

2. Use Fine-Grained Tokens

Consider using GitHub’s fine-grained PATs which offer more precise control over permissions and easier revocation [source].

3. Implement Credential Management

  • Use Git Credential Manager on Windows
  • Use Keychain on macOS
  • Use libsecret on Linux
  • Consider enterprise credential managers for team environments

4. Monitor Token Usage

  • Regularly check active tokens in your GitHub settings
  • Revoke unused tokens
  • Set up notifications for token expirations

5. Document Authentication Setup

Keep documentation on how to authenticate with your repositories, including:

  • Which authentication method to use
  • Where to find credentials
  • How to rotate tokens
  • Emergency procedures for access issues

Sources

  1. GeeksforGeeks - How to Fix “Support for password authentication was removed”?
  2. TheServerSide - Fix GitHub’s ‘support for password authentication was removed’ error
  3. Stack Overflow - Message “Support for password authentication was removed”
  4. MageComp - Generate Personal Access Token GitHub
  5. GitHub Community - Invalid username or password discussion
  6. GitHub Community - Password authentication removed discussion
  7. DEV Community - Support for password authentication was removed
  8. Medium - How to Solve Github’s Password Authentication Removed Error in AWS EC2
  9. LinkedIn - How to fix GitHub’s ‘support for password authentication was removed’ error
  10. AWS Documentation - GitHub personal access token expired

Conclusion

The “Support for password authentication was removed” error is a common issue after GitHub’s 2021 security policy changes, and typically occurs when your PAT has expired, lacks proper permissions, or when credential caching prevents proper authentication. To resolve this, generate a new PAT with appropriate repo scopes, configure your Git credential manager properly, and ensure you’re entering the PAT (not your password) when prompted for credentials. For more reliable long-term authentication, consider switching to SSH keys or GitHub CLI authentication. Regularly audit and rotate your tokens, and document your authentication setup to prevent similar issues in the future.