Why am I getting “Support for password authentication was removed” error when using git pull, even though I created a GitHub token recently?
I’m encountering the following error when trying to use git pull:
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for ...
I created a GitHub token two weeks ago following the official documentation, and it’s set to expire on October 26, 2021. Despite having a valid token, I’m still receiving this authentication error. What could be causing this issue and how can I resolve it?
The error “Support for password authentication was removed” occurs because GitHub discontinued password authentication for Git operations on August 13, 2021, requiring token-based authentication instead. Even with a recently created token, you’re likely experiencing this issue because Git is still trying to use stored credentials rather than your new token, or there are configuration conflicts preventing proper token authentication.
Contents
- Why This Error Occurs with Valid Tokens
- Common Causes of Authentication Failures
- Step-by-Step Troubleshooting Solutions
- Preventing Future Authentication Issues
- When to Contact GitHub Support
Why This Error Occurs with Valid Tokens
Even though you created a GitHub token recently, several factors can prevent Git from using it effectively:
Credential Manager Conflicts: Your system may still have stored GitHub credentials from before the authentication change. When you run git pull, Git’s credential manager might automatically use these stored credentials instead of prompting for your token.
As Stack Overflow explains, “Open Credential Manager and just remove the already-saved credentials for Git: https://github.com. After this step, run the command again for pull/push in the terminal.”
Token Usage Format: GitHub tokens need to be used in a specific format. Instead of typing your username and password, you should use your username and the token as the password, but Git might not be configured to handle this correctly.
Outdated Git Version: Older versions of Git have known issues with credential handling after GitHub’s authentication changes. According to research findings, “Alex, a DevOps engineer, fixed the error by updating Git to the latest version, which resolved a bug in credential handling.”
Configuration File Issues: Your .gitconfig file might contain outdated settings that interfere with proper token authentication. The research specifically mentions that “This issue stems from outdated settings in your .gitconfig file.”
Common Causes of Authentication Failures
Token-Related Issues
- Token Scope Limitations: Your token might not have the required permissions for the specific Git operations you’re attempting
- Token Format Errors: Copying the token incorrectly or including extra characters
- Expired Tokens: Even though your token expires on October 26, 2021, there might be immediate validation issues
Git Configuration Problems
- Credential Manager Misconfiguration: Git’s built-in credential manager might be using outdated authentication methods
- Global Configuration Conflicts: Settings in your global
.gitconfigthat override local repository configurations - Repository-Specific Issues: Local repository configurations that conflict with token authentication
System-Level Issues
- Operating System Credential Storage: Windows Credential Manager, macOS Keychain, or Linux secret managers storing old GitHub credentials
- Network Proxy Settings: Corporate environments or VPNs that interfere with authentication
- Firewall or Security Software: Blocking Git’s authentication attempts
Step-by-Step Troubleshooting Solutions
Solution 1: Clear Saved Credentials
- Windows: Open Credential Manager → Windows Credentials → Remove any entries for
git:https://github.com - macOS: Open Keychain Access → Search for “github” → Delete relevant entries
- Linux: Use
git credential-cache exitor remove credentials from your credential helper
According to GeeksforGeeks, this is often the most effective first step.
Solution 2: Configure Git to Use Your Token
Update your remote URL to include your token:
git remote set-url origin https://YOUR_USERNAME:YOUR_TOKEN@github.com/username/repo.git
Or use this format for one-time operations:
git pull https://YOUR_USERNAME:YOUR_TOKEN@github.com/username/repo.git
Solution 3: Update Git to Latest Version
# Windows
git update-git-for-windows
# macOS (using Homebrew)
brew upgrade git
# Ubuntu/Debian
sudo apt-get update && sudo apt-get install git
Solution 4: Configure Git Credential Helper
Ensure your .gitconfig has proper credential configuration:
git config --global credential.helper store
Then run a Git command that will prompt for credentials, and enter your username and token when prompted.
Solution 5: Generate a New Token with Correct Scopes
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Generate a new token with these scopes:
repo(for full control of public and private repositories)workflow(if working with GitHub Actions)
- Copy the token immediately and store it securely
Preventing Future Authentication Issues
Best Practices for Token Management
- Use Token Expiration: Always set expiration dates for your tokens
- Limit Token Scope: Create tokens with minimal required permissions
- Store Tokens Securely: Use password managers or environment variables
- Regular Token Rotation: Rotate tokens periodically for security
Git Configuration Optimization
# Configure credential helper for better security
git config --global credential.helper cache --timeout 3600
# Use SSH keys as an alternative to tokens
git config --global url."git@github.com:".insteadOf "https://github.com/"
Monitoring and Maintenance
- Regularly check for Git updates
- Monitor GitHub’s authentication documentation for changes
- Keep backup authentication methods (like SSH keys) available
When to Contact GitHub Support
If you’ve tried all the troubleshooting steps above and still experience authentication issues, consider contacting GitHub support if:
- You’re seeing “invalid username or token” errors even with correct credentials
- Your tokens are being rejected immediately after creation
- You’re experiencing authentication issues across multiple repositories or machines
- You suspect rate limiting or account-level restrictions
As noted in the research, “Outdated Git versions or platform CLI tools (e.g., GitHub CLI) can cause authentication issues” - so ensure all your development tools are up to date before reaching out.
Sources
- How to Fix “Support for password authentication was removed.” - GeeksforGeeks
- GitHub Community Discussion - Authentication Failed
- Stack Overflow - Support for password authentication was removed
- The Server Side - Fix GitHub’s Error
- Fix “remote: invalid username or token” Git Error
- Setting Up Personal Access Tokens via R - The Carpentries
- Git Credential Manager Fix - CodeArchPedia
Conclusion
The “Support for password authentication was removed” error persists even with valid tokens primarily due to credential manager conflicts, outdated Git versions, or configuration issues. Start by clearing saved credentials and updating Git, then ensure your token has proper scope and is used in the correct format. For long-term solutions, consider using SSH keys or implementing proper credential helper configurations. Remember that GitHub’s authentication requirements continue to evolve, so staying informed about updates to their documentation will help prevent future authentication issues.