Getting Started
Last updated
Last updated
Your no-reply email can be found at https://github.com/settings/emails and it looks like ${USER_ID}+${USERNAME}@users.noreply.github.com
Your no-reply email can be found at https://gitlab.com/-/user_settings/profile and it looks like ${USER_ID}-${USERNAME}@users.noreply.gitlab.com
Keys are used for platforms to identify you. It's recommended to use Public-Key-Infrastructure (PKI) technologies for your authentication keys, and the below covers generating and submission of SSH and GPG keys. Remember to never send anyone your private keys.
GPG keys are used to sign commits. To generate a GPG key, run:
Enter in options as shown in your terminal:
RSA and RSA
4096-bits long
1 year validity
Enter any name for the Real name field (doesn't have to be your real name)
Use the no-reply email of the platform you are intending to use the GPG key with for the Email field (this is important for personal data hygiene)
Use a computer identifier for the Comment field (ideally you can recognise which device it comes from based on this field)
List your GPG keys using:
Identify the key to export. The ID of the key can be found in the line rsa4096/${KEY_ID}
Export your GPG key using:
Your exported GPG public key should look like:
Copy that block of text and paste it into wherever it needs to be.
SSH keys are used to authenticate you when you are cloning repositories or pushing code changes. To generate an SSH key, run:
Save it to ~/.ssh/id_rsa
if it's your primary SSH key.
To get your public key, assuming it's your primary SSH key, run:
Your public key should look like:
Copy that block of text and paste it into wherever it needs to be
Remember never to share your private key at ~/.ssh/id_rsa
with anyone.
In order for your service provider to identify you, you will have to submit your public keys to the service provider via their web UI. Your computer will sign messages using your private keys before sending them to the service provider who will then verify that the messages can be validated against your pre-uploaded public keys.
Your SSH and GPG keys will be available at:
Navigate to that page and click on New SSH key, give it a name which can identify your machine and paste in your SSH public key from above
Scroll down and click on New GPG key, give it a name which can identify your machine and paste in your public GPG key from above.
Your SSH keys will be available at:
Navigate to that page and click on Add new key, give it a name which can identify your machine and paste in your SSH public key from above
Your GPG keys will be available at:
Navigate to that page and click on Add new key, give it a name which can identify your machine and paste in your GPG public key from above
Finally, we configure our machine to use the keys we generated. SSH keys do not usually face any issues and the SSH agent will be able to find the correct keys to use from ~/.ssh
. We will cover GPG key configurations.
The configuration can be found at .git/config
relative to your project's root directory. Open it up and add the following:
Get the key ID by running gpg --list-secret-keys --keyid-format=LONG
and getting the key ID from the line indicating rsa4096/${KEY_ID}
The following assumes that you have a directory named github.com
where all your Github projects are stored. Open the root Git configuration file at ~/.gitconfig
and add in:
Open the conditionally included file at ~/.github.com.gitconfig
and add in:
Similar to above, get the key ID by running gpg --list-secret-keys --keyid-format=LONG
and getting the key ID from the line indicating rsa4096/${KEY_ID}