setup • SSH key via CLI in Terminal - martindubenet/wed-dev-design GitHub Wiki

The best secure protocol to access git sources from cloud services sutch as GitHub, GitLab or Atlassian BitBucket is using an SSH key.

An SSH key is an access credential in the SSH protocol. Its function is similar to that of user names and (a very complex) passwords, but the keys are primarily used for automated processes and for implementing single sign-on by system administrators and power users.

Source: https://www.ssh.com/ssh/key.

Where are my SSH keys ?

C:\Users\YOUR_USERNAME\.ssh

SSH key file : Privale file VS Public « id_rsa.pub »

Can't find that folder !?

First make sur that you have the access rights to view System files.

The password is optional. If you don't want to provide one simple click « Enter » when the command ask to provide one.

macOS

  1. If you don't have an « .ssh » folder on your workstation, here's the Bash Terminal command lines to create it:
    cd ~/
    mkdir .rss && cd .rss
    
  2. Generate the key
    ssh-keygen -o
    

    -OR-

    ssh-keygen -t rsa -b 2048 -C "<comment>"
    

Windows

Then generate the two SSH required files « id_rsa » and « id_rsa.pub » using one of the two command lines :

ssh-keygen -t ed25519 -C "[email protected]"

How to use it

  • Open the « *.pub » file with your prefered text editor and copy the content of the file.
    •  macOS : ~/.rss/id_rsa.pub
    • Windows : ~/.rss/ls.pub
  • Go to your account settings, go to Profile > Settings > SSH Keys:
  • Click on « Add a new key », give it a name according to your workstation like « office pc », then paste the content of your key then save it.
⚠️ **GitHub.com Fallback** ⚠️