Git Clone Repo via SSH
Steps:
Generate SSH Key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519
Get the
PUBLIC
key and add it toGithub
orGitlab
orother-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.
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
Let’s check Github connection:
ssh -T [email protected]
If everything is OK. you should get:
Hi $USERNAME! You've successfully authenticated, but GitHub does not provide shell access.
Last updated