Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub's personal access token not working? - The requested URL returned error: 403

Tags:

git

github

I have tried everything mentioned in this thread: Pushing to Git returning Error Code 403 fatal: HTTP request failed

I created a GitHub repo on my MacBook Pro, pushed some work up to it from my Lenovo laptop, and am trying to continue work on my Mac. I had been authenticating using a PAT on Windows, but coming back to the Mac using the same PAT I'm getting this error.

I've tried generating new PATs but this hasn't worked. I haven't been pushing code up to GitHub for a couple of years, and I never even needed a password to do this before, and don't remember changing any developer settings?

This is the full message I get when trying to push with GitHub password

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/<username>/<reponame>.git/'

with PAT

remote: Permission to <username>/<reponame>.git denied to <username>.
fatal: unable to access 'https://github.com/<username>/<reponame>.git/': The requested URL returned error: 403

The 403 suggests I suddenly don't have access to my own repo, but I don't know how else I can authenticate than using the PAT. Has anyone encountered this and still remained stuck after trying everything in the above link?

Alternatively, is there any way to make this non-PAT or password protected? There isn't anything particularly sensitive here so it might not need this protective layer?

like image 976
Bill Muxworthy Avatar asked Apr 28 '26 18:04

Bill Muxworthy


1 Answers

By default tokens always include read-only access to all public repositories on GitHub. Hence, to give push or pull and rights you need to select the appropriate "Scope" while creating access token.

The scope for public repositories is public_repo, and for private repositories is repo. A token with one of those scopes is the most limited access possible for Git push or pull access.

For the description of other available scopes refer the Github Documention.

like image 154
Megha Dandapat Avatar answered May 01 '26 19:05

Megha Dandapat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!