Skip to content

Latest commit

 

History

History
136 lines (85 loc) · 3.5 KB

GitHub.md

File metadata and controls

136 lines (85 loc) · 3.5 KB

GitHub configurations

Common configurations for GitHub

Table of Contents

Common links

  • Emojis on GitHub and a list of them (also this)

Signing your commits

Official documentation here.

Setup GPG Key

Windows

On Windows, do the following

  1. From the official gnupg webpage, download gpg4win. Install the program.

  2. Verify that the program is in your path by running

    ($ENV:Path).Replace(";","`n")

    An entry like C:\Program Files (x86)\Gpg4win\..\GnuPG\bin will be in the path, allowing the discovery of gpg.exe

  3. Open Kleopatra and generate new key pair (Ctrl + N or use GUI)

    Make sure you use the GitHub verified email address and set the expiration date accordingly

  4. After the key is generated, verify it by running

    gpg --list-secret-keys --keyid-format=long

    The key ID under sec and ssb should match the subkey details in Kleopatra (double click on key -> more details)

  5. Copy the public key through Kleopatra

    1. Double click the key in Kleopatra
    2. Click Export and copy everything in the window, starting from -----BEGIN PGP PUBLIC KEY BLOCK----- and ending with -----END PGP PUBLIC KEY BLOCK-----
  6. Open GitHub and go to GPG key settings, and add a GPG key. Paste the contents of the clipboard (from the previous step).

  7. Configure the local git to sign commits be default

    Sign commits using GPG by default

    git config --global commit.gpgsign true

    Set the path to the GPG program

    git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"

That's it, try this with a test commit and see the Verified badge beside it on GitHub 🎉

WIP: Not working currently for WSL

For WSL, do the following (assuming Ubuntu WSL)

  1. Verify existing keys and program

    gpg --list-secret-keys --keyid-format=long
    which gpg

    The above should create a ~/.gnupg folder

  2. Verify that git configurations do not already have something setup

    git config --global -l
  3. Generate a new key

    Start the utility

    gpg --full-generate-key

    Select any algorithm (RSA works) and make sure the keysize is 4096. You may set a passphrase.

  4. Get the key

    List them all

    gpg --list-secret-keys --keyid-format=long

    Get a particular key (assuming ID - after algo/ in sec line - is 3AA5C34371567BD2)

    gpg --armor --export 3AA5C34371567BD2

    Copy the output to clipboard

  5. Open GitHub and go to GPG key settings, and add a GPG key. Paste the contents of the clipboard (from the previous step).

  6. Configure git locally to use gpg

    Automatically sign commits

    git config --global commit.gpgsign true

    Set the path

    git config --global gpg.program `which gpg`

    Verify

    git config --global -l