Girtch27
Posts: 11
Joined: Sat Dec 16, 2017 4:33 pm
Location: Canada

Github

Sat Apr 20, 2019 8:04 pm

When I try the below command, I get an error, this is my first time using git. So I definitely don't know how it works. I have an account with Github.
I believe I setup the git on the raspberry pi correctly, I followed a raspberry pi beginner project to learn the basics but it doesn't really explain what to do when things go wrong...

git push -u origin master

Doesn't seem to work, I get this:

The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

***********
From what I can tell its trying to upload to github but can't, how do I gain permission?
Do I need to setup something in my Github account first then apply a key?
I'm using a WIN laptop and connect to the RPi using VNC over wi-fi. I setup the Rpi yesterday with Raspbian so I assume its all up to date.

PS i'm about to read the below info I saw mentioned in an earlier post,
https://www.raspberrypi.org/magpi-issues/MagPi27.pdf

Girtch27
Posts: 11
Joined: Sat Dec 16, 2017 4:33 pm
Location: Canada

Re: Github

Sat Apr 20, 2019 10:39 pm

I figured it out. I didn't have any SSH keys in GitHub so on the RPi I re-generated them, I have two RPis, and added each Pi's key into GitHub.

First I enabled SSH under the Raspberry Pi's Configuration | Interfaces, not sure if this is required but I knew I only had Camera and VNC enabled.
Then I followed this guide https://help.github.com/en/articles/gen ... ssh-agent to generate and copy new keys into GitHub.

No idea why it didn't generate and match them to my GitHub account originally, I followed this guide, either I missed a step or something else went wrong: https://projects.raspberrypi.org/en/pro ... d-with-git
Originally I had SSH interface disabled -could that have block the connect and caused it? Anyway I enabled SSH, did the steps listed in the guide above. Not sure if SSH needs to be enabled to work with GitHub.

I also found the git article which starts in MagPi #27 https://www.raspberrypi.org/magpi-issues/MagPi27.pdf handy.

Heater
Posts: 12182
Joined: Tue Jul 17, 2012 3:02 pm

Re: Github

Sun Apr 21, 2019 1:46 pm

That is mighty strange because I have never had to mess around with ssh keys to use github.

As a check I just created a new project locally and a new repo on github and di the usual:

$ git remote add origin https://github.com/heater/someproject.git
$ git push -u origin master

And it just worked as usual. No need for fiddling with ssh keys.

Have you been setting up ssh keys : https://github.com/settings/keys

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22134
Joined: Sat Jul 30, 2011 7:41 pm

Re: Github

Sun Apr 21, 2019 4:01 pm

Heater wrote:
Sun Apr 21, 2019 1:46 pm
That is mighty strange because I have never had to mess around with ssh keys to use github.

As a check I just created a new project locally and a new repo on github and di the usual:

$ git remote add origin https://github.com/heater/someproject.git
$ git push -u origin master

And it just worked as usual. No need for fiddling with ssh keys.

Have you been setting up ssh keys : https://github.com/settings/keys
Depends how you set up the repo on github as to whether it uses SSH keys or password authentication.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Heater
Posts: 12182
Joined: Tue Jul 17, 2012 3:02 pm

Re: Github

Sun Apr 21, 2019 5:26 pm

Yes, looking now I find that is so. Never thought about it before seeing as the default is not to use SSH keys.

Girtch27
Posts: 11
Joined: Sat Dec 16, 2017 4:33 pm
Location: Canada

Re: Github

Sun Apr 21, 2019 6:07 pm

Heater wrote:
Sun Apr 21, 2019 1:46 pm
Have you been setting up ssh keys : https://github.com/settings/keys
Yes, when on the RPi I couldn't get it to work with GitHub so I followed some info to manually generate and add those keys to GitHub, seemed to make sense at the time. Assumed this is how it all worked. Seems most use another method. I'd like to know how that works. When I do the "git push -u origin master" command it asks me to enter a passphrase though..

Girtch27
Posts: 11
Joined: Sat Dec 16, 2017 4:33 pm
Location: Canada

Re: Github

Sun Apr 21, 2019 6:15 pm

jamesh wrote:
Sun Apr 21, 2019 4:01 pm
Depends how you set up the repo on github as to whether it uses SSH keys or password authentication.
How do I switch to password authentication? It wasn't easy to figure out the SSH keys, generate them, find them in some file, copy and add into GitHub. If I add more repos on these existing RPis I assume these keys remain, like they are tied to the individual RPi. I might setup more RPis so don't want to do this again if there is an easier way that everyone else uses... if possible send a link to a guide and I should be able to follow it. I searched around quickly but didn't find anything, i'll search some more later... thanks in advance.

Return to “General programming discussion”