12

I have the error message:

remote: Write access to repository not granted.
fatal: unable to access 'https://github.com/...../...../': 
The requested URL returned error: 403

My friend invited me to his repository, and I used his personal token while cloning it.
But it says the above error.

I also tried with my own token but it says the same.

I also faced this when I created my own repository and was making initial commit and push.
This issue has grown ever since Git*Hub has brought token authentication into account.

How can I get past this?

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
Bisheshwor Neupane
  • 121
  • 1
  • 1
  • 4

4 Answers4

12

Try and recreate a PAT(Personal Access Token) with, as scope, the repo ones.
And, for testing, chose an expiration date "never", to be sure it remains valid.

That token should start with ghp_...: it should then authenticate you properly, allowing you to clone the repository, and push back to it.

Note: a token is akin to a password (but can easily be revoked/regenerated), so you should not use any other tokens but your own.

Reejesh
  • 157
  • 1
  • 2
  • 7
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
7

when you create your access token
In expiration: it should say No expiration.
In selecte scopes you mark the repo radio button.
As shown in the image below

enter image description here

Elie Eid
  • 156
  • 1
  • 7
2

You need to get a write access from for the repo. Try asking your friend to give that. I solved it this way

Sardorek Aminjonov
  • 498
  • 2
  • 5
  • 14
2

Go to your local repository folder and find a hidden folder called ".git". find a file called "config" in the folder as attached below.
enter image description here

You need to change the url = https://github.com/... to SSH url that can find from GitHub repository(on git hub Web portal) cone menu as below picture.

enter image description here

This is what the config file looks like, after the change of the url. enter image description here

This solved my issue. I belive this will help.