07 Jan 2025

Setup SSH For Github

This guide explains how to generate an SSH key, add it to GitHub, and use it to securely clone repositories without entering credentials repeatedly.

thumbnail

#Create Private Key and Public Key

cd ~/.ssh/

ssh-keygen -t rsa
  • and Enter 3x for set all default (id_rsa)

#Add SSH key to Github

cat ~/.ssh/id_rsa.pub

# my ssh result
ssh-rsa AAAAB3NzaC1asd1231SCF5uqz3/lX+S2E2WUqac1Uuok4ydXnfB
+ucUg56kS/oWo+YsBxJqPfrNIcHEuHNzEW6SpoGkdv/xk9UYRLdsZ3qmgo5l/R
BeCkRsI1YTux+ekXhkk7Uz7dL//M6zX4QBIgQAz5ARnfTv0646lBi/2gUokqyY
qP207JNNyA/K5wtPx6IBu0swmBV86asdwadqLapkJQAHJ4naLUUIVPzKi/1YeGX
mLdDxKkpM7Awad21s21Gasd21@#3zp8ZxH1TdOd0wK91MwO1k77UngTNwkYJzbF
1vSlZCOfEQ10fUmWzqYChOM+nX0Ejc8pz7RtvP50q/EtsoALGpTQEUorAhmeofz
SKkcUtiFV9nZ+v+v6dtQzQgyLEPleWvc= example@example21

#Check Connection SSH

ssh -T git@github.com

# Hi hudadamar21! You've successfully authenticated
  • DONE.

. . .

Now you can clone repository from github using ssh

#Example clone with SSH

git clone git@github.com:hudadamar21/stuff-box.git

👍