Skip to content

Instantly share code, notes, and snippets.

@wzul
Forked from ankurk91/github_gpg_key.md
Created December 5, 2020 07:51

Revisions

  1. @ankurk91 ankurk91 revised this gist Sep 15, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    ```
    # Ubuntu
    sudo apt-get install gpa seahorse
    # MacOS
    # MacOS with https://brew.sh/
    brew install gpg
    ```
    * Generate a new gpg [key](https://help.github.com/articles/generating-a-new-gpg-key/)
    @@ -30,7 +30,7 @@ uid User Name <[email protected]>
    ssb 4096R/62E5B29EEA7145E 2016-08-11
    ```
    * Note down your key ```COPY_LONG_KEY``` from above (without `<` and `>` sign)
    * Note down your key ```COPY_LONG_KEY``` from above (without `<` and `>`)
    * **Export this (public) key to a text file**
    ```
    gpg --armor --export <PASTE_LONG_KEY_HERE> > gpg-key.txt
    @@ -39,7 +39,7 @@ gpg --armor --export <PASTE_LONG_KEY_HERE> > gpg-key.txt

    * **Add this key to GitHub**
    * Login to Github and goto profile [settings](https://github.com/settings/keys)
    * Click ```New GPG Key``` and paste the content of ```gpg-key.txt``` file then save
    * Click ```New GPG Key``` and paste the contents of ```gpg-key.txt``` file then save

    * **[Tell](https://help.github.com/articles/telling-git-about-your-gpg-key/) git client to auto sign your future commits**
    * Use the long key from above in next command
  2. @ankurk91 ankurk91 revised this gist Aug 8, 2018. 1 changed file with 8 additions and 21 deletions.
    29 changes: 8 additions & 21 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -3,11 +3,11 @@
    * Do you have an Github account ? If not create one.
    * **Install required tools**
    * Latest [Git Client](https://git-scm.com/downloads)
    * gpg tools
    * gpg tools
    ```
    # Ubuntu
    sudo apt-get install gpa seahorse
    # Mac
    # MacOS
    brew install gpg
    ```
    * Generate a new gpg [key](https://help.github.com/articles/generating-a-new-gpg-key/)
    @@ -30,7 +30,7 @@ uid User Name <[email protected]>
    ssb 4096R/62E5B29EEA7145E 2016-08-11
    ```
    * Note down your key ```COPY_LONG_KEY``` from above
    * Note down your key ```COPY_LONG_KEY``` from above (without `<` and `>` sign)
    * **Export this (public) key to a text file**
    ```
    gpg --armor --export <PASTE_LONG_KEY_HERE> > gpg-key.txt
    @@ -41,23 +41,10 @@ gpg --armor --export <PASTE_LONG_KEY_HERE> > gpg-key.txt
    * Login to Github and goto profile [settings](https://github.com/settings/keys)
    * Click ```New GPG Key``` and paste the content of ```gpg-key.txt``` file then save


    * **Tell git client to auto sign your future commits**
    * Run this command
    ```
    gpg --list-keys
    ```
    * Above command should return like this -
    ```
    /home/username/.gnupg/pubring.gpg
    -------------------------------
    pub 4096R/<COPY_SHORT_KEY> 2016-08-11 [expires: 2018-08-11]
    uid Your Name <[email protected]>
    sub 4096R/EB61969F 2016-08-11 [expires: 2017-08-11]
    ```
    * Copy the short key from above and use this in command below
    * **[Tell](https://help.github.com/articles/telling-git-about-your-gpg-key/) git client to auto sign your future commits**
    * Use the long key from above in next command
    ```
    git config --global user.signingKey <PASTE_SHORT_KEY_HERE>
    git config --global user.signingkey <PASTE_LONG_KEY_HERE>
    git config --global commit.gpgsign true
    ```
    * You are done, next time when you commit changes; gpg will ask you the passphrase.
    @@ -92,8 +79,8 @@ Type:
    save
    ```

    ### Reference Links
    * https://help.github.com/categories/gpg/
    ### Reference links
    * https://help.github.com/articles/signing-commits-with-gpg/
    * http://nishanttotla.com/blog/signing-git-commits-gpg/
    * https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
    * https://news.ycombinator.com/item?id=7792026
  3. @ankurk91 ankurk91 revised this gist Aug 8, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -103,4 +103,4 @@ save
    * https://help.ubuntu.com/community/GnuPrivacyGuardHowto
    * https://medium.com/@timmywil/sign-your-commits-on-github-with-gpg-566f07762a43#.aovevj80y
    * https://blog.erincall.com/p/signing-your-git-commits-with-gpg

    * https://dev.to/agrinman/spoof-a-commit-on-github-from-anyone-4gf4
  4. @ankurk91 ankurk91 revised this gist Sep 27, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,6 @@ sub 4096R/EB61969F 2016-08-11 [expires: 2017-08-11]
    ```
    git config --global user.signingKey <PASTE_SHORT_KEY_HERE>
    git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```
    * You are done, next time when you commit changes; gpg will ask you the passphrase.

  5. @ankurk91 ankurk91 revised this gist Feb 11, 2017. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ ssb 4096R/62E5B29EEA7145E 2016-08-11
    ```
    * Note down your key ```COPY_LONG_KEY``` from above
    * **Export this key to a text file**
    * **Export this (public) key to a text file**
    ```
    gpg --armor --export <PASTE_LONG_KEY_HERE> > gpg-key.txt
    ```
    @@ -42,7 +42,7 @@ gpg --armor --export <PASTE_LONG_KEY_HERE> > gpg-key.txt
    * Click ```New GPG Key``` and paste the content of ```gpg-key.txt``` file then save


    * **Tell git to auto sign your future commits**
    * **Tell git client to auto sign your future commits**
    * Run this command
    ```
    gpg --list-keys
    @@ -63,7 +63,7 @@ git config --global tag.gpgsign true
    ```
    * You are done, next time when you commit changes; gpg will ask you the passphrase.

    ### Make gpg remember your passphrase
    ### Make gpg remember your passphrase (tricky)
    To make it remember your password, you can use ```gpg-agent```

    Edit your ```~/.gnupg/gpg-agent.conf``` file and paste these lines
    @@ -102,4 +102,6 @@ save
    * http://stackoverflow.com/questions/10161198/is-there-a-way-to-autosign-commits-in-git-with-a-gpg-key
    * http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html
    * https://help.ubuntu.com/community/GnuPrivacyGuardHowto
    * https://medium.com/@timmywil/sign-your-commits-on-github-with-gpg-566f07762a43#.aovevj80y
    * https://blog.erincall.com/p/signing-your-git-commits-with-gpg

  6. @ankurk91 ankurk91 revised this gist Oct 15, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Github : Signing commits using GPG (Ubuntu/Mac) :closed_lock_with_key:

    * You have an account on Github already ? If not create one.
    * Do you have an Github account ? If not create one.
    * **Install required tools**
    * Latest [Git Client](https://git-scm.com/downloads)
    * gpg tools
    @@ -86,8 +86,8 @@ At the gpg prompt type:
    ```
    passwd
    ```
    Type in the current passphrase when prompted
    Type in the new passphrase twice when prompted
    Type in the current passphrase when prompted<br>
    Type in the new passphrase twice when prompted<br>
    Type:
    ```
    save
  7. @ankurk91 ankurk91 revised this gist Oct 6, 2016. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -61,9 +61,9 @@ git config --global user.signingKey <PASTE_SHORT_KEY_HERE>
    git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```
    * You are done, next time when you commit changes gpg will ask you the password you gave above.
    * You are done, next time when you commit changes; gpg will ask you the passphrase.

    ### Make gpg remember your password
    ### Make gpg remember your passphrase
    To make it remember your password, you can use ```gpg-agent```

    Edit your ```~/.gnupg/gpg-agent.conf``` file and paste these lines
    @@ -78,16 +78,16 @@ If gpg-agent is not running you can start it with this command
    gpg-agent --daemon
    ```

    ### Change your key Passphrase
    ### Change your key passphrase
    ```
    gpg --edit-key <PASTE_YOUR_KEY_ID_HERE>
    ```
    At the gpg prompt type:
    ```
    passwd
    ```
    Type the current passphrase when prompted
    Type the new passphrase twice when prompted
    Type in the current passphrase when prompted
    Type in the new passphrase twice when prompted
    Type:
    ```
    save
  8. @ankurk91 ankurk91 revised this gist Oct 6, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## Github : Signing commits using GPG (Ubuntu/Mac)
    ## Github : Signing commits using GPG (Ubuntu/Mac) :closed_lock_with_key:

    * You have an account on Github already ? If not create one.
    * **Install required tools**
    @@ -61,6 +61,7 @@ git config --global user.signingKey <PASTE_SHORT_KEY_HERE>
    git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```
    * You are done, next time when you commit changes gpg will ask you the password you gave above.

    ### Make gpg remember your password
    To make it remember your password, you can use ```gpg-agent```
  9. @ankurk91 ankurk91 revised this gist Oct 2, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Github : Signing commits using GPG (Ubuntu/Mac)

    * You have an account on Github already ? If not ceate one.
    * You have an account on Github already ? If not create one.
    * **Install required tools**
    * Latest [Git Client](https://git-scm.com/downloads)
    * gpg tools
    @@ -14,7 +14,7 @@ brew install gpg
    ```
    gpg --gen-key
    ```
    * Answer the question asked
    * Answer the questions asked
    > Note: When asked to enter your email address, ensure that you enter the verified email address for your GitHub account.
    * **List generated key**
    @@ -63,7 +63,7 @@ git config --global tag.gpgsign true
    ```

    ### Make gpg remember your password
    To make it remember your password you can use ```gpg-agent```
    To make it remember your password, you can use ```gpg-agent```

    Edit your ```~/.gnupg/gpg-agent.conf``` file and paste these lines
    ```
  10. @ankurk91 ankurk91 revised this gist Sep 20, 2016. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -77,6 +77,21 @@ If gpg-agent is not running you can start it with this command
    gpg-agent --daemon
    ```

    ### Change your key Passphrase
    ```
    gpg --edit-key <PASTE_YOUR_KEY_ID_HERE>
    ```
    At the gpg prompt type:
    ```
    passwd
    ```
    Type the current passphrase when prompted
    Type the new passphrase twice when prompted
    Type:
    ```
    save
    ```

    ### Reference Links
    * https://help.github.com/categories/gpg/
    * http://nishanttotla.com/blog/signing-git-commits-gpg/
    @@ -85,4 +100,5 @@ gpg-agent --daemon
    * https://overflow.no/blog/2016/08/11/signed-commits-with-gpg-git-and-github-on-linux/
    * http://stackoverflow.com/questions/10161198/is-there-a-way-to-autosign-commits-in-git-with-a-gpg-key
    * http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html
    * https://help.ubuntu.com/community/GnuPrivacyGuardHowto

  11. @ankurk91 ankurk91 revised this gist Sep 20, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -63,15 +63,15 @@ git config --global tag.gpgsign true
    ```

    ### Make gpg remember your password
    gpg will ask for your key password on each time you make git commit,
    to make it remember your password you can use ```gpg-agent```
    To make it remember your password you can use ```gpg-agent```

    Edit your ```~/.gnupg/gpg-agent.conf``` file and paste these lines
    ```
    default-cache-ttl 28800
    max-cache-ttl 28800
    ```
    *28800 seconds means 8 hours*

    If gpg-agent is not running you can start it with this command
    ```
    gpg-agent --daemon
  12. @ankurk91 ankurk91 revised this gist Sep 20, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -71,7 +71,7 @@ Edit your ```~/.gnupg/gpg-agent.conf``` file and paste these lines
    default-cache-ttl 28800
    max-cache-ttl 28800
    ```
    __28800 seconds means 8 hours__
    *28800 seconds means 8 hours*
    If gpg-agent is not running you can start it with this command
    ```
    gpg-agent --daemon
  13. @ankurk91 ankurk91 revised this gist Sep 20, 2016. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -62,6 +62,20 @@ git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```

    ### Make gpg remember your password
    gpg will ask for your key password on each time you make git commit,
    to make it remember your password you can use ```gpg-agent```

    Edit your ```~/.gnupg/gpg-agent.conf``` file and paste these lines
    ```
    default-cache-ttl 28800
    max-cache-ttl 28800
    ```
    __28800 seconds means 8 hours__
    If gpg-agent is not running you can start it with this command
    ```
    gpg-agent --daemon
    ```

    ### Reference Links
    * https://help.github.com/categories/gpg/
  14. @ankurk91 ankurk91 revised this gist Sep 20, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    * You have an account on Github already ? If not ceate one.
    * **Install required tools**
    * Latest [Git Client](https://git-scm.com/downloads)
    * gpg tools
    ```
    # Ubuntu
    sudo apt-get install gpa seahorse
    @@ -55,7 +57,7 @@ sub 4096R/EB61969F 2016-08-11 [expires: 2017-08-11]
    ```
    * Copy the short key from above and use this in command below
    ```
    git config --global user.signingkey <PASTE_SHORT_KEY_HERE>
    git config --global user.signingKey <PASTE_SHORT_KEY_HERE>
    git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```
  15. @ankurk91 ankurk91 renamed this gist Aug 27, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions github_gpg.md → github_gpg_key.md
    Original file line number Diff line number Diff line change
    @@ -68,4 +68,5 @@ git config --global tag.gpgsign true
    * https://news.ycombinator.com/item?id=7792026
    * https://overflow.no/blog/2016/08/11/signed-commits-with-gpg-git-and-github-on-linux/
    * http://stackoverflow.com/questions/10161198/is-there-a-way-to-autosign-commits-in-git-with-a-gpg-key
    * http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html

  16. @ankurk91 ankurk91 revised this gist Aug 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github_gpg.md
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,7 @@ gpg --list-keys
    /home/username/.gnupg/pubring.gpg
    -------------------------------
    pub 4096R/<COPY_SHORT_KEY> 2016-08-11 [expires: 2018-08-11]
    uid Austin Ankur <[email protected]>
    uid Your Name <[email protected]>
    sub 4096R/EB61969F 2016-08-11 [expires: 2017-08-11]
    ```
    * Copy the short key from above and use this in command below
  17. @ankurk91 ankurk91 revised this gist Aug 17, 2016. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions github_gpg.md
    Original file line number Diff line number Diff line change
    @@ -60,3 +60,12 @@ git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```


    ### Reference Links
    * https://help.github.com/categories/gpg/
    * http://nishanttotla.com/blog/signing-git-commits-gpg/
    * https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
    * https://news.ycombinator.com/item?id=7792026
    * https://overflow.no/blog/2016/08/11/signed-commits-with-gpg-git-and-github-on-linux/
    * http://stackoverflow.com/questions/10161198/is-there-a-way-to-autosign-commits-in-git-with-a-gpg-key

  18. @ankurk91 ankurk91 revised this gist Aug 17, 2016. 1 changed file with 23 additions and 6 deletions.
    29 changes: 23 additions & 6 deletions github_gpg.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## Github : Signing commits using GPG (Ubuntu)
    ## Github : Signing commits using GPG (Ubuntu/Mac)

    * You have an account on Github already ? If not ceate one.
    * **Install required tools**
    @@ -23,22 +23,39 @@ gpg --list-secret-keys --keyid-format LONG
    ```
    /home/username/.gnupg/secring.gpg
    -------------------------------
    sec 4096R/<COPY_THIS_KEY> 2016-08-11 [expires: 2018-08-11]
    sec 4096R/<COPY_LONG_KEY> 2016-08-11 [expires: 2018-08-11]
    uid User Name <[email protected]>
    ssb 4096R/62E5B29EEA7145E 2016-08-11
    ```
    * Note down your key ```COPY_THIS_KEY``` from above
    * **Export this key**
    * Note down your key ```COPY_LONG_KEY``` from above
    * **Export this key to a text file**
    ```
    gpg --armor --export <PASTE_KEY_HERE> > gpg-key.txt
    gpg --armor --export <PASTE_LONG_KEY_HERE> > gpg-key.txt
    ```
    * Above command will create a new txt file ```gpg-key.txt```

    * **Add this key to GitHub**
    * Login to Github and goto profile [settings](https://github.com/settings/keys)
    * Click ```New GPG Key``` and paste the content of ```gpg-key.txt``` file then save


    * **Tell git to auto sign your future commits**
    * Run this command
    ```
    gpg --list-keys
    ```
    * Above command should return like this -
    ```
    /home/username/.gnupg/pubring.gpg
    -------------------------------
    pub 4096R/<COPY_SHORT_KEY> 2016-08-11 [expires: 2018-08-11]
    uid Austin Ankur <[email protected]>
    sub 4096R/EB61969F 2016-08-11 [expires: 2017-08-11]
    ```
    * Copy the short key from above and use this in command below
    ```
    git config --global user.signingkey <KEY_HERE>
    git config --global user.signingkey <PASTE_SHORT_KEY_HERE>
    git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```
  19. @ankurk91 ankurk91 revised this gist Aug 17, 2016. 1 changed file with 18 additions and 6 deletions.
    24 changes: 18 additions & 6 deletions github_gpg.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,12 @@
    ## Prepare system
    ## Github : Signing commits using GPG (Ubuntu)

    * You have an account on Github already ? If not ceate one.
    * *Install required tools*
    * **Install required tools**
    ```
    sudo apt-get install git
    # Ubuntu
    sudo apt-get install gpa seahorse
    # Mac
    brew install gpg
    ```
    * Generate a new gpg [key](https://help.github.com/articles/generating-a-new-gpg-key/)
    ```
    @@ -12,7 +15,7 @@ gpg --gen-key
    * Answer the question asked
    > Note: When asked to enter your email address, ensure that you enter the verified email address for your GitHub account.
    * *List generated key*
    * **List generated key**
    ```
    gpg --list-secret-keys --keyid-format LONG
    ```
    @@ -26,8 +29,17 @@ ssb 4096R/62E5B29EEA7145E 2016-08-11
    ```
    * Note down your key ```COPY_THIS_KEY``` from above
    * *Export this key*
    * **Export this key**
    ```
    gpg --armor --export <PASTE_KEY_HERE> > gpg-key.txt
    ```
    * Above command will create a new txt file ```gpg-key.txt```
    * Above command will create a new txt file ```gpg-key.txt```


    * **Tell git to auto sign your future commits**
    ```
    git config --global user.signingkey <KEY_HERE>
    git config --global commit.gpgsign true
    git config --global tag.gpgsign true
    ```

  20. @ankurk91 ankurk91 created this gist Aug 17, 2016.
    33 changes: 33 additions & 0 deletions github_gpg.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    ## Prepare system
    * You have an account on Github already ? If not ceate one.
    * *Install required tools*
    ```
    sudo apt-get install git
    sudo apt-get install gpa seahorse
    ```
    * Generate a new gpg [key](https://help.github.com/articles/generating-a-new-gpg-key/)
    ```
    gpg --gen-key
    ```
    * Answer the question asked
    > Note: When asked to enter your email address, ensure that you enter the verified email address for your GitHub account.
    * *List generated key*
    ```
    gpg --list-secret-keys --keyid-format LONG
    ```
    * Above command should return like this
    ```
    /home/username/.gnupg/secring.gpg
    -------------------------------
    sec 4096R/<COPY_THIS_KEY> 2016-08-11 [expires: 2018-08-11]
    uid User Name <[email protected]>
    ssb 4096R/62E5B29EEA7145E 2016-08-11
    ```
    * Note down your key ```COPY_THIS_KEY``` from above
    * *Export this key*
    ```
    gpg --armor --export <PASTE_KEY_HERE> > gpg-key.txt
    ```
    * Above command will create a new txt file ```gpg-key.txt```