On August 13, 2021, GitHub removed support for password authentication, causing many developers to encounter issues when trying to push or pull from their repositories. If you’ve run into the error message “Support for password authentication was removed,” don’t worry! Here’s a step-by-step guide to get you back on track using personal access tokens (PATs).
1. Generate a Personal Access Token (PAT)
First things first, you need to create a PAT:
- Go to GitHub.com and log in to your account.
- Click on your profile picture in the top-right corner and select “Settings.”

- In the left sidebar, click on “Developer settings.”, it should be at the bottom

- Select “Personal access tokens” and then “Tokens (classic).”
- Click “Generate new token” and follow the prompts to create your token.



- Make sure to copy your new token immediately – you won’t be able to see it again!
- Update Your Authentication Method
Now that you have your PAT, you need to use it instead of your password. Here are a few ways to do this:
Option A: Update Your Remote URL
Run this command
git remote set-url origin https://<YOUR-PAT>@github.com/<USERNAME>/<REPOSITORY>.git
This command changes the URL Git uses to communicate with GitHub. By including your PAT in the URL, Git will use it automatically for authentication, eliminating the need to enter it manually each time.
Option B: Use the PAT When Prompted
Simply use your PAT as the password when Git prompts you for authentication.
This method allows you to keep your existing remote URL unchanged. It’s useful if you prefer not to store your PAT in your Git configuration or if you work with multiple repositories with different authentication requirements.
2. Operating System-Specific Solutions
These methods store your PAT securely in your system’s credential manager, so Git can access it automatically
For Windows Users
- Open Credential Manager from Control Panel.
- Find the GitHub entry under “Windows Credentials”.
- Edit the entry, replacing the password with your PAT.
For macOS Users
- Open Keychain Access app.
- Search for “github.com”.
- Edit the internet password entry for GitHub, replacing the password with your PAT.
These steps update your system’s secure credential storage, allowing Git to use your PAT automatically without you needing to enter it each time or store it in plain text.
For Linux Users
Run
git config --global credential.helper store
This command tells Git to store your credentials (including your PAT) after you enter them the first time. It saves them in a local file, so use this method cautiously on shared systems.
3. Using SSH Instead of HTTPS
If you prefer SSH
git remote set-url origin git@github.com:<USERNAME>/<REPOSITORY>.git
SSH provides a secure communication channel without needing to manage PATs. It’s especially useful for automation and scripts. This command switches your repository from HTTPS to SSH authentication.
Conclusion
These changes might seem inconvenient at first, but they significantly improve the security of your GitHub account and projects. By understanding why each step is necessary, you can choose the method that best fits your workflow and security needs.
Remember, never share your PAT publicly. If you suspect it’s been compromised, you can easily revoke it from your GitHub settings without affecting your main account password.
If you love this post, checkout Mastering Github Essential Commands for every Developer