Git Clone Repo via SSH

Steps:

  1. Generate SSH Key

ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519
  1. Get the PUBLIC key and add it to Github or Gitlab or other-Git-itteration

cd ~/.ssh/
cat key.pub
  • Now click New SSH key on top. Type name of your key (something like Work MacBook) and paste contents of your public key.

  1. Let’s force your machine to use proper key for Github SSH connection. Go back to your terminal:

vim ~/.ssh/config
  • Paste config:

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/github
    PreferredAuthentications publickey
  1. Let’s check Github connection:

ssh -T git@github.com
  • If everything is OK. you should get: Hi $USERNAME! You've successfully authenticated, but GitHub does not provide shell access.

Last updated