Github
SSH Key
Generate key
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"Add private key to ssh-client
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsaInstall xclip
sudo apt-get install xclipCopy generated file to clipboard (CTRL + C)
xclip -sel clip < ~/.ssh/id_rsa.pub
# Example of generated key
# ssh-rsa AAAB3NzaC1cy2EAAAAADQABAAACAQDF/x8E3SaF8TuBkd/Wl1SAfdcpZ1x5LIQpyU/T6IKYBh3Ez+MgCg8FDZcS41PTgJmdytlYv56DxBkRMjgLb5LhzlAxDBp2zJ3hyHJe/e+DOspoeLSbDbTXk9zRyG6W9K4ucxAyXXly5+dcjI79plMxAuejtw63FNTJ/EBCvF73RLQUsqGesdjE2h1fLM2hYhvXkjlajDS2YwfTaFXfTkt/T1UVjQm45xQW4uY1QDHjyt6GzeSkVcacpgJeUYVdIzSfUPTW+RGPwU/dUaknLSOkBBG+c1FYYh6m4pT6sT1tmmLtOgCbCciGWslRVy2xgXTx+lCpl8r8aqT8YYxxyHRHiV7/WRmoglF9dI4idaUYDb7gs7MJV/ekGGtQKzzCUrkY6YPJguL4S13GN9dvnmIf0YQCAzmv/SbYweqBOs87HJMs6yjwQ5YdTBEBCCHDBBMnXOagOkg6u8sHEytwjrDhqGTNd6x6/BEq9NHyofw6i8tSlfiUL3fsmndWZqUIDhT6rYS6iNTs6a9oSUbbit11xU+B50Pw9Bg5ygfUIdlYrhxVYE6bBX8yGY4H3ivAD2E0+i1vBzOQkrx14W4PW0P0xyvVn5McBaByC2RbcoOBonTPI8FfRvhxAhKvMwoC/Le/n/LVJDy/93sOJEflXgrSCsgiWO45L4+ftlsZ91+dwQ== viniciusfesil@gmail.comOpen Github and Add the ssh key
Github Shortcuts
Shift + /Github: Signing commits using GPG (Ubuntu/Mac) 
Install GPG Tools
Generate a new GPG key
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
Note down your key
COPY_LONG_KEYfrom aboveExport this (public) key to a text file
The above command will create a new txt file
gpg-key.txtAdd this key to GitHub
Login to Github and goto profile settings
Click
New GPG Keyand paste the content ofgpg-key.txtfile then saveTell git client to auto sign your future commits
Run this command
Copy the short key from above and use this in the command below
You are done, next time when you commit changes; GPG will ask you the 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
If gpg-agent is not running you can start it with this command
Change your key passphrase
At the gpg prompt type:
Type in the current passphrase when prompted Type in the new passphrase twice when prompted Type:
Reference Links
Last updated
Was this helpful?