GitHub no longer supports password authentication over HTTPS. Instead, you need to use a Personal Access Token (PAT) for secure authentication.
Step 1: Generate a Personal Access Token (PAT)
- Navigate to GitHub Tokens
- Click "Generate new token (classic)"
- Select the following scopes:
- ✅
repo(Access to repositories) - ✅
workflow(For GitHub Actions) - ✅
write:packages(Optional, if pushing to GitHub Packages)
- ✅
- Generate and copy the token securely.
Step 2: Update Git Remote URL with the New Token
Run the following command to set your repository's remote URL:
git remote set-url origin https://<TOKEN>@github.com/your-username/your-repository.git
💡 Replace <TOKEN> with the newly generated token and adjust your-username/your-repository accordingly.
Step 3: Push Changes to GitHub
Once the remote URL is updated, push your changes using:
git push origin main
If authentication is successful, your changes will be pushed to GitHub. If you experience any issues, verify the token permissions and ensure it has not expired.
By following these steps, you can securely authenticate with GitHub and continue working with your repositories without any authentication issues.