Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clone GitHub repo with fine-grained token

With classical Github tokens you can clone a repo like this:

git clone https://<your-token>@github.com/owner/repo.git

This doesn't work with the new fine-grained tokens.

How do you clone a GitHub repo with the new fine-grained tokens?

like image 830
Floris Devreese Avatar asked Sep 03 '25 06:09

Floris Devreese


2 Answers

When using fine-grained tokens you have to prefix the token with oauth2: user.
like this:

git clone https://oauth2:<your-fine-grained-token>@github.com/owner/repo.git

*credits to Andy's comment here

like image 84
Floris Devreese Avatar answered Sep 04 '25 22:09

Floris Devreese


It's the same for fine-grained tokens too.

git clone https://<your-token>@github.com/owner/repo.git

You need to grant Permissions Commit statuses, Contents, Pull requests and Metadata as Read to be able to Clone repositories. And the same Permissions need to the Read and Write to be able to push changes.

I wish the Github Permission names were a bit more intuitive or better organized :D It seems like most people get annoyed with which permission to give and fall back to the classic token.

like image 45
Siddhartha Mondal 'Sid' Avatar answered Sep 04 '25 22:09

Siddhartha Mondal 'Sid'