Skip to content

Instantly share code, notes, and snippets.

@dl6nm
Created November 4, 2022 06:51
Show Gist options
  • Save dl6nm/0820a67346badf1263d0cd6e155b18a3 to your computer and use it in GitHub Desktop.
Save dl6nm/0820a67346badf1263d0cd6e155b18a3 to your computer and use it in GitHub Desktop.
Sign your Git commits with GPG key

Sign your Git commits

After you add your public key to your account, you can sign individual commits manually, or configure Git to default to signed commits.

Sign individual Git commits manually:

  1. Add -S flag to any commit you want to sign:

    git commit -S -m "My commit message"

  2. Enter the passphrase of your GPG key when asked.

  3. Push to an online git repository (GitHub, GitLab, ...) and check that your commits are verified.

Sign all Git commits by default by running this command:

git config --global commit.gpgsign true

Source: GitLab Docs - https://docs.gitlab.com/ee/user/project/repository/gpg_signed_commits/#sign-your-git-commits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment