Irrelevant Context
I recently decided to migrate my JetBrains IDE settings from their automatic settings sync over to storing the settings in a repository - with far-off hopes that it’ll be less annoying and inconsistent.
I created blank repos to store settings for GoLand, PyCharm, WebStorm, and DataGrip.
The frustrating part is that the JetBrains repo sync doesn’t seem to support SSH, so my usual auth method is out; for my IDEs to use these repos, I have to set up a GitHub personal access token for JetBrains to use - and there’s currently no built-in way to limit access tokens to specific repositories. I only want the JetBrains access token to work for the settings repositories, specifically.
The Workaround: Blank GitHub Collaborator Accounts
It’s pretty straightforward to create a GitHub account. Tada. And it may be wise to enable 2FA for good measure.
Send the invites on your primary account
Now on each of the desired repositories, I go to Settings > Manage Access > Invite a collaborator.
Accept the invites on your collaborator account
Actually finding these invitations in the collaborator account is far harder than it should be. Invitations are supposed to show up in GitHub notifications, but this isn’t true for me. The 2 ways that worked for me include 1) via the invitation email GitHub sends or 2) navigating to https://github.com/<your_account>/<your_invite_repo>/invitations
directly. Obviously you need to be logged into the collaborator account.
Generate a personal access token on your collaborator account
Heading on over to Settings > Developer Settings > Personal Access Tokens, the new token is ripe for the generating.
We’re still forced to use an overly broad scope (because GitHub), but at least the token only has access to the specific repositories we set up.
Copy the plaintext token which, like us, is transient and won’t be accessible later.
And now you have your personal access token with limited repository access.