Skip to content

Instantly share code, notes, and snippets.

@SahilDhingraa
Last active April 22, 2024 18:00
Show Gist options
  • Save SahilDhingraa/40d46ea7111e7037871e5ff8a0586add to your computer and use it in GitHub Desktop.
Save SahilDhingraa/40d46ea7111e7037871e5ff8a0586add to your computer and use it in GitHub Desktop.
Github Signed Commit
  1. DOWNLAOD gpg4win from: https://www.gpg4win.org/download.html

  2. install it

  3. Add GnuPG's path to the environment variables: default path is: C:\Program Files (x86)\GnuPG\bin

  4. run gpg --version

  5. run gpg --full-generate-key

  6. select (1) default

  7. keysize value: 4096

  8. key is valid for: 1y

  9. next: y

  10. Real name: your name with cast

  11. email: 'enter your email'

  12. comment: enter anything

  13. press o

  14. now eneter a passphrase that you know you'll remember

  15. then run gpg --list-keys --keyid-format LONG

  16. then fetch id from the first line: example: "pub rsa4096/F0E2B4938795 2023-05-27 [SC] [expires: 2024-05-26]" in this id is: "F0E2B4938795"

  17. the run gpg --armor --export <your id>

  18. then copy your public key with the comments begin and end

example:

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGRx9qwBEADDPsHt4YvxxzYCBtZAigauG6BYd21Fcs4SPpt0Yu17yKk4YMMv F0knQVEDWdJqcrqk8FZl512SG37VfYgYuPZbgcjBwe3wDixua2qDGZuirWv1CU+y Emyk7WtjMmCy1nfQgHFIW+GCNAjp+/wCwe4fz0aV1JoFVzT1LO3AHx80uLfz8rZA oU17Z7BwArFKMsMtaY7FlnlopHIzWgbOEfh7BtejwF2NGyIjxImTFk7Ni02SJ7ks +hS4Dfpqf9RuQqEISenG82rXHoCkMJmEXjxFKtqgAHYcg0QwhgDoIXNrGUDDRqea 29bstockbnWO3YB4Odr2c3xKxl1itryF1Y8U/lIsdJtF8e02P8jhxdRg85Rggo8h ie9w5EChwhbSybmaHsMuTg5zlr5/KP77Md4ftJ4NzRjbpYK/m0SJ1EAUxJV437L9 T9Q4j88ZH15wgHjRYmSNcwqyPMR+ypZNwKgkrQ3kOcj6IxCHIWdsHtluR0137xtz 73/o2PDzIGS2TL/G8d09LQl/MqSN19CHLbDZHnpnjvRZsptBqPGub8MEofYk =Q5WW -----END PGP PUBLIC KEY BLOCK-----

  1. then go to your github profile settings and goto "SSH and GPG keys"

  2. then new gpgkey and paste your key there with the title you want

  3. now copy KEY ID from github

  4. run git config --global user.signingkey <your key id>

  5. then run git config --global commit.gpgsign true

  6. then run git config --global tag.gpgsign true

  7. then open CMD and run where gpg for linux: which gpg

  8. then run git config --global gpg.program "<where gpg command result>"

  9. then restart your terminal and you're good to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment