Member-only story

How to sign commits in Github

Emad Dehnavi
3 min readAug 20, 2024

Most of the companies or open source projects have a Code of Conduct and usually one of their policies in their Contributor License Agreement (CLA) for code submission, is that your commit need to be signed/verified.

How to sign a commit in Github

One of the best tools for Mac users is GPG Suite that allows you to store your GPG key passphrase in the macOS Keychain. Once you install it you can create a key pair by filling this form, where you need to use the email used for your github account:

Create a key pair in GPG Suite

Once the key is created, you need to copy the public key ( Right click and copy ) and in your Github setting page, go to SSH and GPG keys tab and paste your public key and give it a title

SSH and GPG keys page

Now everytime you want to commit, if you use -S flag, it will signed your commit

git commit -S -m "YOUR_COMMIT_MESSAGE"

You will be asked for the password you set in GPG Suite and you need to enter it

To configure your Git client to sign commits by default for a local repository, in Git…

--

--

Emad Dehnavi
Emad Dehnavi

Written by Emad Dehnavi

With 8 years as a software engineer, I write about AI and technology in a simple way. My goal is to make these topics easy and interesting for everyone.

No responses yet