ls -al ~/.ssh
There should be files named id_rsa
(private key) and id_rsa.pub
(public key) or similarly named key pairs.
If there is no SSH key available you will receive a message like: ls: cannot access '/c/Users/dell/.ssh': No such file or directory
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Follow the prompts properly to save the key, and you can press Enter to accept the default file location. When prompted for a passphrase, you can choose to set one or leave it empty by pressing Enter.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Copy your SSH key to your clipboard:
cat ~/.ssh/id_rsa.pub
Go to GitHub SSH settings, click "New SSH key," paste your key, and save it.
ssh -T git@github.com
You should see a success message like:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
Ensure your repository's remote URL uses the correct SSH format. Run:
git remote -v
If it shows a URL starting with https://
, update it to the SSH format:
git remote set-url origin git@github.com:jekhokie/raspberry-noaa-v2.git
git clone git@github.com:jekhokie/raspberry-noaa-v2.git
This will resolve the Permission denied (publickey)
issue and successfully clone your repository via SSH.