element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Security and Identification
  • Technologies
  • More
Security and Identification
Blog GitHub and GIT: sign your commits with a certificate
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Security and Identification to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 25 Nov 2021 11:12 AM Date Created
  • Views 17826 views
  • Likes 5 likes
  • Comments 2 comments
  • security
  • git
Related
Recommended

GitHub and GIT: sign your commits with a certificate

Jan Cumps
Jan Cumps
25 Nov 2021

When you're working on open source projects, they sometimes ask you to sign your commits.
That's the common way to confirm that you agree with the software license and development rules.

There are different ways to to this. By adding a comment to the commit message, or by using a digital certificate.

Commit message signing - plain

This is the simplest way, and is accepted by many open source projects.
In your commit, you add the --signoff key to the GIT command.

git commit -a -m "added unit test --signoff

This will automatically add your info. The result (e.g.: on Github) will look like this:

image

(the green check on the right doesn't mean this is a verified commit, it's not related to the signature.)

Commit message signing - with a Certificate

With this process, you confirm the activity by signing the commit with a key.

Create a PGP key

First take care that you have a sign key. It's not hard to generate one.
I'm using the GIT bash on a Windows 10 PC to launch the commands.

Maybe you have a key. Check with

gpg --list-keys

If you don't have one, you'll see output like this:

image

But if you have one, you can reuse it. Check if it hasn't expired:

image

If you don't have an existing certificate, here's how you create one:

 gpg --gen-key

image

Register your public key on GitHub

This is an optional step. It will take care that the verified tag is put next to your signed commits.

Get your public key content into a text file:

gpg --output public.pgp --armor --export your.mail@yourprovider.com

image

Then navigate to your your online Github profile, Settings, SSH and GPG keys: 

image

Add a New GPG key, and paste the content of the text file you just created into the field. Save.

Use your key when committing changes

When you commit, add the -S option to the command line

git commit -S -a -m "refactured the API"

You can check if the signature was successful:

 git log --show-signature -1

image

Once you push your changes to the server, GitHub flags them as verified:

image

That's it.

  • Sign in to reply
Parents
  • Jan Cumps
    Jan Cumps over 3 years ago

    Here is an example that show how this can be used in a fully automated flow:

    I submitted a pull request for Microsoft Azure (link).
    They validate if I signed my commits, and also validate if I have signed the CLA (Contribution License Agreement)

    image

    If I don't do that, the pull request workflow will keep my pull request pending.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • Jan Cumps
    Jan Cumps over 3 years ago

    Here is an example that show how this can be used in a fully automated flow:

    I submitted a pull request for Microsoft Azure (link).
    They validate if I signed my commits, and also validate if I have signed the CLA (Contribution License Agreement)

    image

    If I don't do that, the pull request workflow will keep my pull request pending.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube