clone GitHub repo with fine-grained token

10.8k Views Asked by At

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?

2

There are 2 best solutions below

3
On BEST ANSWER

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

0
On
git clone https://${token}@github.com/${owner}/${repo}.git