Skip to content

Script to import GPG Public Keys for validating signed commits on GitHub

License

Notifications You must be signed in to change notification settings

mojotx/import_github_gpg_key

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Import GitHub GPG Key

Description

This shell script queries the GitHub REST API and retrieves the GPG keys for a specified user, so that you can validate their GPG-signed commits.

Requirements

The shell script is written for Bash, and should run without modification on Linux, macOS, Microsoft Windows Subsystem for Linux, and any other UNIX-like operating system that supports the following executable commands:

Usage

You will need to create a GitHub token for authenticating with the GitHub REST API. You can easily do that by going to https://github.com/settings/tokens. Note that there is no need to specify any special permissions for this token; it's just used for the query.

Pass the generated token to the script as an environment variable, $GITHUB_TOKEN:

Method One

You can set the environment variable in your shell, like this, before calling the script.

GITHUB_TOKEN="ghp_blahblahblahexampleblahblahblah"
./query-user.sh mojotx

Method Two

You can also place the environment variable in a text file named .github_token, and place it in the same directory as the script, or in your home directory.

echo 'GITHUB_TOKEN="ghp_blahblahblahwhateverblahblah"' > ~/.github_token
./query-user.sh mojotx

Source

The API I use is documented here.

License

This script is licensed under the MIT License.

About

Script to import GPG Public Keys for validating signed commits on GitHub

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages