I know there's been questions about this previously, but I am still getting an annoying error when trying to push a repository:
git push --set-upstream origin main
Username for 'https://github.com': xxx
Password for 'https://[email protected]':
After I enter my personal access token, it errors out with:
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. fatal: Authentication failed for 'https://github.com/sahwa/thesis.git/'
I have created an access token and been using is successfully for a while, but git will still return the above error occasionally for no apparent reason. I am using git version 2.32.0.
I should add that a) this is a new personal access token that isn't expired and b) has all of the correct scopes selected.
Does anyone know how to resolve this?
CodePudding user response:
The issue is likely your remote, which is set automatically when you git clone
!
You can see and change the remote to the git
protocol, rather than https
as
git remote -v # display
git remote set-url origin [email protected]:User/UserRepo.git
CodePudding user response:
Does the personal access token have any expiration or set to lifetime? Assuming that its set to life time this is the proper method to login using personal access token
git push https://<GITHUB_ACCESS_TOKEN>@github.com/<GITHUB_USERNAME>/<REPOSITORY_NAME>.git
better way would be to sign into a git client like in IntelliJ or VScode extension and let it handle the reauthentication and push