Cookie Consent by Free Privacy Policy Generator Aktuallisiere deine Cookie Einstellungen ๐Ÿ“Œ Verifying Git commits using GPG


๐Ÿ“š Verifying Git commits using GPG


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

Digital Signatures are used to sign texts, letters and other messages. Git is no exception, but why do we need it?

Why to sign Git commits

When we fill out documents, we sign to acknowledge that we have read the document and take responsibility for its contents.

In git, we need to make it clear that I wrote the code and everything in the commit was written by me. But why?

Git solves a lot of development problems, but there are just as many loopholes for spoofing.

Git commits are based on trust, and most commit developers use simple credentials to identify the commit author, such as user.name and user.email.

Unfortunately, this data can easily be spoofed by someone else knowing your name and email. When submitted to a remote repository, the commit will show something other than your name and a link to your profile.

Keep in mind that the author on the commit is just an indication of the author, not proof that this person did the work.

Sounds strange, doesn't it? We use our repository account to submit, not just email. Unlike change push, commits don't take into account who the author or committer is, they use a configuration setting.

How do you prove you're a committer and not a liar?

Signing your commit solves this problem. Now no one can impersonate you and give away someone else's code as yours. All you need to do is have the encryption key and use it when you commit.

In addition you get a nice green Verified sign next to your commit.

Verified commit

GnuPG is an excellent tool for encrypting and signing your data. GPG creates a key pair: private and public keys. You'll need the public one to sign it. We will export this public key into our GitHub and GitLab accounts later.

The more you value the security of your application, the more you have to pay attention to your code and its authors.

You can set up your projects so that pushing into protected branches requires all commits to be signed.

View the list of existing keys on the system:

gpg --list-secret-keys --keyid-format LONG

GPG keys list

B38EC0C87C413474 - fingerprint of the private key.

If you do not have a key, you can generate it with the command:

gpg --full-generate-key

Read the GPG article to learn more about the creation and use cases.

To upload a public key to GitHub and GitLab, you'll have to export it.

gpg --armor --export B38EC0C87C413474

The result is that we now have the contents of the public key, which we copy and use for our account.

-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGObaKUBEACjfWN6hEiwSBXbHX1VCnlG8oO08gTToAVcRlfEjIyF5wixboUw
Fhp6jTsLyKlju7J9ucvIxsWC1a7nuNgC8cLM5mpqOkAIUMnmmxX3EipP8cPDDZLk
X9lPqfkSgQXJmUGV8xrh1LhOAOwxEmJVkB8Se44Gg74KoXOsEw2lx/KnoOvmBAuo
...
-----END PGP PUBLIC KEY BLOCK-----

Note that you copy the entire key, with the BEGIN PGP PUBLIC KEY BLOCK and the END PGP PUBLIC KEY BLOCK

Setting up Git to sign commits

You can set up a Git signature with a pair of keys from gpg signing:

git config --global user.signingkey B38EC0C87C413474

You can now sign commits with a key if you specified the -S flag when you created them.

git commit -S

You can also tell Git to automatically sign all your commits:

git config --global commit.gpgSign true

Adding the GPG key to GitHub

Add GPG key (public key) to the SSH and GPG settings page, which will link it to your account.

GitHub GPG keys

Adding the GPG key to GitLab

Add GPG key (public key) to the GPG settings page, which will link it to your account.

GitLab GPG keys

Conclusion

Signing tags and commits is a wonderful idea, without a doubt, but if you decide to incorporate it into your daily workflow, you need make sure that everyone on your team is familiar with the process.

...



๐Ÿ“Œ Verifying Git commits using GPG


๐Ÿ“ˆ 67.5 Punkte

๐Ÿ“Œ Simplify Your Dev Life with Git, SSH & GPG: How to Work with Multiple Code Hosts and Sign Your Commits with Ease


๐Ÿ“ˆ 42.02 Punkte

๐Ÿ“Œ Git Squash Commits โ€“ Squashing the Last N Commits into One Commit


๐Ÿ“ˆ 40.16 Punkte

๐Ÿ“Œ GNOME gnome-keyring 3.4.0/3.4.1 gkd-gpg-agent-ops.c gpg-cache-method idle/timeout access control


๐Ÿ“ˆ 35.18 Punkte

๐Ÿ“Œ gpg-tui v0.6.0 release - supports importing GPG keys from the clipboard


๐Ÿ“ˆ 35.18 Punkte

๐Ÿ“Œ How to install GPG (gnupg2) on a Debian Linux to fix gpg command not found error


๐Ÿ“ˆ 35.18 Punkte

๐Ÿ“Œ A clean Git history with Git Rebase and Conventional Commits


๐Ÿ“ˆ 33.16 Punkte

๐Ÿ“Œ [OC]Linux kernel commits as of 5.7-rc1 by author's email domain name,for domains with >= 5000 commits.


๐Ÿ“ˆ 31.44 Punkte

๐Ÿ“Œ [OC]Linux kernel commits as of 5.7-rc1 by author's email domain name,for domains with >= 5000 commits.


๐Ÿ“ˆ 31.44 Punkte

๐Ÿ“Œ git switch and git checkout โ€“ How to switch branches in git


๐Ÿ“ˆ 26.16 Punkte

๐Ÿ“Œ Top Git Commands | Most Used Git Commands | Git Commands With Examples


๐Ÿ“ˆ 26.16 Punkte

๐Ÿ“Œ Verifying Authenticode signatures using ci.dll in kernel-land


๐Ÿ“ˆ 25.48 Punkte

๐Ÿ“Œ Verifying Integrity of Files using NodeJS


๐Ÿ“ˆ 25.48 Punkte

๐Ÿ“Œ Mystery Git ransomware appears to blank commits, demands Bitcoin to rescue code


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Windows Switch To Git Almost Complete: 8,500 Commits and 1,760 Builds Each Day


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Enhance your git log with conventional commits


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ The Linux kernel has surpassed one million git commits


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ How to Use SSH Keys and 1Password to Sign Git Commits


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Git Log: Die Commits eines Projekts auflisten und durchsuchen


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Get a List of All Git Commits Including the Lost Ones


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ How to Squash Commits in Git After They Have Been Pushed?


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Move Commits Between Branches in Git - 3 Different Methods ๐Ÿ’


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Split a commit into 2 commits with `git rebase`


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ How to Revert a Range of Commits in Git


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Signatur-Lรถsung fรผr Git-Commits von Keeper Security - Dev-Insider


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ How to Use Git Cherry Pick and Avoid Duplicate Commits


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Enhance your git log with conventional commits


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ How to Undo the Most Recent Local Commits in Git?


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Git: The complete guide to sign your commits with an ssh key


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Git commit helper: add emojis to your commits


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Defending Your Commits From Known CVEs With GitGuardian SCA And Git Hooks


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Squashing Git Commits for a Cleaner Commit History


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ Mastering Git with ChatGPT โ€” best auto-commits you've ever seen


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ How atomic Git commits dramatically increased my productivity - and will increase yours too


๐Ÿ“ˆ 24.44 Punkte

๐Ÿ“Œ The Power of Atomic Commits in Git: How and Why to Do It


๐Ÿ“ˆ 24.44 Punkte











matomo