The extension commits to your repository on your behalf, so it needs a personal
access token with permission to write files. This takes about a minute.
Two kinds of token exist.
A fine-grained token can be locked to a single repository, which is what we
recommend. A classic token is quicker but grants access to everything you
own. Both work.
Fine-grained token (recommended)
Open the token page
Go straight to
github.com/settings/personal-access-tokens/new. You can also reach it through your profile picture, then Settings,
Developer settings, Personal access tokens,
Fine-grained tokens.
Name it and set an expiry
Something like LeetCode Uploader. Any expiry works. When it lapses
the extension will tell you the token expired, and you repeat these steps.
Pick the repository
Under Repository access, choose Only select repositories and
select the repo you want your solutions committed to. If the repo belongs to an
organisation, set Resource owner to that organisation first.
Grant write access to files
Open Repository permissions, find Contents, and set it
to Read and write. That single permission is all the extension
uses. Metadata: Read-only is added automatically and cannot be removed.
Generate and copy it
Press Generate token. The token starts with
github_pat_ and is shown exactly once, so copy it before leaving
the page.
Paste it into the extension
Click the extension icon, paste the token, and press Connect. It will
confirm which account it connected as.
If your repository is owned by an organisation
Fine-grained tokens may need an organisation owner to approve them before they work.
Until that happens the extension reports that it cannot see the repository.
Classic token
If you would rather use a classic token, or your setup requires one:
Tick the repo scope
Under Select scopes, check repo. This grants access to
all of your repositories, which is why the fine-grained option is preferable.
Generate and copy it
Classic tokens start with ghp_ and are also shown only once.
Keeping the token safe
Store a copy in a password manager. GitHub will not show it to you again, but
you can always delete the old one and generate a replacement.
The extension keeps the token in Chrome's extension storage on your machine and
sends it only to api.github.com.
If you ever paste a token somewhere public, revoke it immediately from the same
settings page. A revoked token stops working straight away.
If it does not work
The extension says
Cause
That token is invalid or has expired
The token was mistyped, revoked, or has passed its expiry date.
Generate a new one.
Cannot see owner/repo
The repository was not included under Repository access, or
an organisation has not approved the token yet.
Your token can read this repo but not write to it
Contents is set to Read-only. Change it to
Read and write.