Ssh Private Repo from RaspberryPi

So I can’t quite find the right solution, after hours searching and trying different solutions.
I’m trying to set up ssh from my RaspberryPi to work with a private repo on my GitHub. I was using https fine, but was annoyed with having to enter my username and password every time I pushed a commit. After switching to ssh from https, now I get the error:

pi@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

What am I doing wrong?!

Did you add the SSH key of the raspi to your Github account, as described here? I’d skip the xclip stuff though and just cat the public key file to copy. :wink:

Thank for the reply! I did add it to my GitHub account - several times, actually. Following the steps to generate a new key a few times. I did use xclip to copy it though, but it seemed to accept it. I do get a “Hi txtack! You’ve successfully authenticated…” message after running the ssh -vT git@github.com command, but still get the permission denied message when I try git pull

Wait a minute, that looks like git tries to login as the user pi instead of git as it should. Please check git remote -v, the URL for the Github repository needs to follow the pattern git@github.com:USER/REPO.git.

1 Like

OMG I THINK THAT’S IT! I didn’t click on “use SSH” when I copied the repo link from GitHub, because I initially cloned it using HTTPS! When I switched it on my pi, I only switched https to ssh! It sounds like that should fix it, I’m now trying to remember how I changed that ssh URL and I’ll be trying it!

(if you can’t tell, I’m new to this but having fun learning about it all)

1 Like

That was it!

Here’s what it was: ssh://github.com/txtack/TackleBot.git
Changed it to: git@github.com:txtack/TackleBot.git
Ran git pull
And it worked!!! Thank you so much!!!

1 Like

Nice, I’m glad to hear that! :smile: