Just a quick reminder to myself for next time as to how to set up a fine-grained access token with GitHub.
- Log on to GitHub
- Go to Settings (under your avatar, upper right corner)
- Go to <> Developer settings (lower left)
- Click Personal access tokens
- Click Fine-grained tokens
- Click Generate new token
- Set the name, date (max. 1 year from now)
- Click Only select repositories and pick the repo
- Under repository permissions, pick Commit statuses, Content, Merge queues and Pull requests for read-write; Metadata should be automatically selected for Read access
- Click Generate token
- Copy the token, "
github_...
" and store it somewhere safe
Now, on your own host, from the git
command line, you should be able to do the following:
git remote add origin https://[your token here]@github.com/[your username]/[your repo name].git
or, if the remote repo was already configured,
git remote set-url origin https://[your token here]@github.com/[your username]/[your repo name].git
That's it. You're all set, you should be able to do a git push origin master or use tools like Microsoft's Visual Studio Code.