Raspberry Pi Tips

Configure Github to RaspPi

Raspberry Pi 3 Model B V1.2

  $ cat /etc/debian_version
  9.11

Git and github configuration on Raspberry Pi

Basically, procedure is the same as the way to setup ssh key for github on Macbook. Addint to that, I did following operation for clone and push remote repository.


Clone remote repository

$ git clone https://github.com/tatoflam/midi-synth.git worked for my RaspPi environment instead of git clone git@github.com:tatoflam/midi-synth.git.

  $ git clone git@github.com:tatoflam/midi-synth.git
  Cloning into 'midi-synth'...
  Permission denied (publickey).
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.

  $ git clone https://github.com/tatoflam/midi-synth.git
  Cloning into 'midi-synth'...
  remote: Enumerating objects: 462, done.
  remote: Total 462 (delta 0), reused 0 (delta 0), pack-reused 462
  Receiving objects: 100% (462/462), 1.14 MiB | 455.00 KiB/s, done.
  Resolving deltas: 100% (247/247), done.

Push local repository to clone

1. create SSH key
  $ ssh-keygen -t rsa -C tato.flam@mail.com
  Generating public/private rsa key pair.
  Enter file in which to save the key (/home/pi/.ssh/id_rsa): 
  Enter passphrase (empty for no passphrase): 
  Enter same passphrase again: 
  Your identification has been saved in /home/pi/.ssh/id_rsa.
  Your public key has been saved in /home/pi/.ssh/id_rsa.pub.
2. copy public key (in this case, I used xsel for copy commandline to clipboard)
  $ cat id_rsa.pub | xsel --clipboard --input

if you don't have xsel,

  $ sudo apt-get install xsel
2. copy public key (in this case, I used xsel for copy commandline to clipboard)
  $ cat id_rsa.pub | xsel --clipboard --input
3. paste public key to Github

At github website, "setting" > "SSH and GPG keys", paste the public key you copied at 2.

4. Validate SSH key access

Create config file

  $ vim ~/.ssh/config

At config, describe following defintion

  Host github
    HostName github.com
    IdentityFile ~/.ssh/id_rsa
    User git

Confirm access. If you can see following message, it's OK to access Github over SSH.

  $ ssh -T git@github.com
  Hi [user name]! You've successfully authenticated, but GitHub does not provide shell access.
5. Push your local "origin" repository to remote "master" repository
  $ git push -u origin master

Refs: