Join us
Learn how to use SSH keys to securely communicate with remote code servers like GitHub, GitLab, and Bitbucket
SSH stands forâ-â"Secure Shell"
It is a protocol that enables secure communication between 2 machines over the internet
An SSH key is just a secure alternative to email/password authentication to identify yourself as a valid contributor to a remote repository on GitHub, GitLab, and Bitbucket.
Entering an email and password can become a pain any time you may want to clone down or push your code up to a remote source, thus setting up SSH keys will save you some time, not to mention the added layer of security through encryption between communications.
SSH keys are generated using a combination of symmetric and asymmetric encryption as well as hashing to provide a secure tunnel when sharing data between devices.
cd ~/.ssh
ls
id_rsa.pub
file, then you already have an SSH key (no need to generate a new one)ssh-keygen -t rsa -b 4096 -C "<EMAIL>"
(replace <EMAIL>
with your email)/Users/<USERNAME>/.ssh/id_rsa
)Ok, great! Now, I have an SSH key. Wait⊠how do I access it?
pbcopy < ~/.ssh/id_rsa.pub
(to copy SSH key to clipboard)Ok, so now I have copied the SSH key, what do I do with it?
Step 1â-âGo to https://github.com/
Step 2- Log into your account
Step 3- From the top right profile dropdown, choose "Settings"
Step 4- Now, from the left vertical menu list, click on "SSH and GPG keys"
Step 5- Under the SSH keys section, click on the green buttonâ-â"New SSH key"
Step 6- Now, fill in the details for the "Title" and "Key" fields
Step 7- Finally, click on "Add SSH key"
Step 1â-âGo to https://gitlab.com/users/sign_in
Step 2- Log into your account
Step 3- From the top right profile dropdown, choose "Preferences"
Step 4- Now, from the left vertical menu list, click on "SSH Keys"
Step 5- Now, fill in the details for "Key", "Title" and "Expires at" fields:
Step 6- Finally, click on "Add SSH key"
Step 1- Go to https://bitbucket.org/
Step 2- Log into your account
Step 3- From the bottom left profile avatar dropdown, choose "Personal settings"
Step 4- Now, under the "Personal settings" menu list on the left side, click on "SSH keys" under the "Security" section
Step 5- Click on "Add key"
Step 6â-âFill in the fields for "Label" and "Key"
Step 7- Finally, click on "Add key" at the bottom
Now that you have added the SSH key to a remote account like GitHub, GitHub will no longer prompt you for your credentials (email and password) any time you clone a repository down or push updates to it.
rm ~/.ssh/id_rsa ~/.ssh/id_rsa.pub
(deletes both public + private keys)Already, that's all I had⊠hope that helps!
Before I leave, a few thingsâŠ
References:
Join other developers and claim your FAUN account now!
Software Engineer
@nprantoInfluence
Total Hits
Posts
Only registered users can post comments. Please, login or signup.