How to add Raspberry Pi's SSH key to our Git

The steps here are meant to be run on your MacBook and NOT on Raspberry Pi.

  1. Get the SSH key make sure you have already generated the SSH key for the Raspberry Pi.

    Refer here on how to generate a new key for Raspbery Pi.

  2. Paste the key to authorized_keys this step has to be done on the Orwell server.

    sudo vim /home/pi/.ssh/authorized_keys

  3. Clone gitolite-admin we are going to checkout the administrative git project on your MacBook.

    git clone ssh://git@deriabiru.my:2020/gitolite-admin.git ~/gitolite-admin

    Cloning into 'gitolite-admin'...
    remote: Counting objects: 2088, done.
    remote: Compressing objects: 100% (1263/1263), done.
    remote: Total 2088 (delta 655), reused 1431 (delta 501)
    Receiving objects: 100% (2088/2088), 252.28 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (655/655), done.
    Checking connectivity... done.
  4. Add the key create a new file in *.pub format for the new key and paste the content inside.

    vim ~/gitolite-admin/keydir/schema.pub

  5. Set permission put the new schema in group "pi".

    vim ~/gitolite-admin/conf/gitolite.conf

    @pi = page kemasul ulubernam marley uie synn-pi perakagromill jendarata-pi peladang lokheng chalok binu-1 lassa-display jengka8 binu-new tersang leparutara4 mempaga keratong9 palongtimur penggeli chiku sertinghilir raspberry kerteh rkp fpe pantairemis bukitkapah unique aringa waha airtawar tenggarohtimur sungaiterah bukit-mendi sonique sonique-demo binu-display unique-display demo jendarata perakagro airtawar malmaju lafarge-dust lafarge-ems keratong9-display raspberrypi muaziq bukitmendi cppom trolak nitar binu-pi serasa tenggarohtimor chinteck advanced-medical besout langkap synn balingian seberangperak kggajah sgterah master kuantantrading
    
  6. Commit and push make permanent changes.

    cd ~/gitolite-admin

    git status

    git add *

    git commit -m "Your message goes here"

    git push origin master

    Counting objects: 6, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (5/5), done.
    Writing objects: 100% (6/6), 833 bytes | 0 bytes/s, done.
    Total 6 (delta 2), reused 0 (delta 0)
    To git:/gitolite-admin
       883b30f..dc447a1  master -> master
    
  7. Test the git connection issue the command from the Raspberry Pi that owns the newly added generated key.

    ssh -p2020 git@deriabiru.my

    PTY allocation request failed on channel 0
    hello schema, this is git@www running gitolite3 v3.6.2-24-g8e36230 on git 2.1.0
    
     R W	deriabiru-theme-drupal
     R W	orwell
     R W	orwell-module-drupal
    Connection to deriabiru.my closed.
    
  8. Test the tunnel connection issue the command from the same Raspberry Pi.

    ssh -p443 pi@ssh.orwell.my