The GitHub Key Rotator (gkr) is a CLI tool to automate the process of rotating GitHub / GitHub Enterprise SSH keys.
-
Make sure your computer has:
node
:>=12.0.0
npm
:>=6.0.0
ssh-agent
,ssh-keygen
&ssh-add
-
Create a GitHub personal access token
- please do check the
admin:public_key
permision for the token
- please do check the
-
Install the CLI:
npm install -g github-key-rotator
-
Generate the key with CLI
gkr -e YOUR_EMAIL -t YOUR_GITHUB_ACCESS_TOKEN # more usage please see gkr --help
-
Config your
~/.ssh/config
to have:######Add this section only if you are on MacOS###### Host * AddKeysToAgent yes UseKeychain yes ##################################################### Host github.com # or your GitHub Enterprise Domain Hostname github.com # or your GitHub Enterprise Domain IdentityFile ~/.ssh/github # same as the arg of `--file -f` you pass to the CLI, default is `~/.ssh/github` IdentitiesOnly yes
npm test
: run tests (currently only run linting)npm run lint
: run lint & typechecknpm run build
: build the cli for localnpm start
: dev withts-node