Hi there 👋!
Prerequisite:
- GPG Installed
- Git Installed
Fish Shell
- Generating GPG Key
gpg --full-gen-key
- After generation of your GPG Key, run
gpg --list-secret-keys --keyid-format LONG
to list your GPG Keys
- Now Copy The ID like this
- Tell Git about your signing Key, make sure that you have configured git name and email
git config --global user.signingkey ED267DF4249ACCC3
git config --global gpg.program (which gpg)
git config --global commit.gpgsign true
Here ED267DF4249ACCC3
is my GPG key ID, replace it with yours.
- Now set The value of GPG_TTY value.
set -gx GPG_TTY (tty)
Add the above line to your config.fish file which is located in $HOME/.config/fish/config.fish
Now let us test if our GPG works by running
echo "hello" | gpg --clearsign
If it prompts password for using your GPG key (if any) and generates a sign like above, then your GPG Sign is configured successfully to sign commits
To sign a commit
git commit -S -m "your message"
-You can check for Sign by running git log --show-signature -1
To get verified, you must add your GPG Key to your github account.
Export the GPG Public by running
gpg --armor --export ED267DF4249ACCC3
remember to replace ED267DF4249ACCC3
with your own.
- Visit GitHub, login and click your profile icon, select settings
- In the user settings sidebar, click SSH and GPG keys.
Select SSH And GPG Keys
Click the add GPG key button
Click the add GPG Key button.
Now your commits that are signed with it are shown as verified in GitHub 😃
Will Link post for windows CMD and Bash below after ASAP! 🤓
Thanks for reading the Post!, Have a nice day!! 😄
Top comments (1)
git config --global user.signingkey (gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{split($0,a,"/"); print a[2]}' | awk '{split($0,a," "); print a[1]}')