DEV Community

Jadi
Jadi

Posted on

Sign your git commits, no-nonsense ! without “intro”, “why” & …

Image description

I’m not going into “why you should sign” and blah blah to make this post longer. Most people are here because they needed to sign their commits and they searched (mainly my self future!).

First, check your keys. Signing with SSH keys is easier because most people already do have their ssh keys & are using them to login into the github. So check the ~/.ssh/ directory for a pair of id_rsa and id_rsa.pub (or any other format of the key you have).

Second, tell the git command to use them for signing. In my case it would be:

git config --global gpg.format ssh
git config --global user.signingkey /home/jadi/.ssh/id_rsa.pub
Enter fullscreen mode Exit fullscreen mode

Obviously your directory will be different and you may want to omit the --global to set the configuration only for the project you are in.

Next, sign your commits with the -S switch:

git add this_file that_file
git commit -S -m 'This is a signed commit'
Enter fullscreen mode Exit fullscreen mode

you already have a commit and you need to sign it? use the commit --amend -S

Last step is adding this signing key to your github account. Go to the https://github.com/settings/keys, add the public key (so /home/jadi/.ssh/id_rsa.pub) in my case and save it as a signing key. This will lead to a verified badge near your signed commits.

Done.

DevCycle image

Fast, Flexible Releases with OpenFeature Built-in

Ship faster on the first feature management platform with OpenFeature built-in to all of our open source SDKs.

Start shipping

Top comments (0)

AWS Q Developer image

Build your favorite retro game with Amazon Q Developer CLI in the Challenge & win a T-shirt!

Feeling nostalgic? Build Games Challenge is your chance to recreate your favorite retro arcade style game using Amazon Q Developer’s agentic coding experience in the command line interface, Q Developer CLI.

Participate Now

👋 Kindness is contagious

Explore this insightful piece, celebrated by the caring DEV Community. Programmers from all walks of life are invited to contribute and expand our shared wisdom.

A simple "thank you" can make someone’s day—leave your kudos in the comments below!

On DEV, spreading knowledge paves the way and fortifies our camaraderie. Found this helpful? A brief note of appreciation to the author truly matters.

Let’s Go!