Jul 04 2020
RPI-Processing P5.js-GITLAB
i will not document the project itself here,but there are some work aspects that i need to log here:
-1- over the years work with processing ( old processing.js / processing JAVA / processing P5.js )
i maintained a 3D show tool PTZ
what i developed prior to now build in 'camera' functions, and still like its 'look and feel'.
here special i added a slider version X rot, Y rot, Z oom,
what allows operation from android and other touchscreens.
add i play with DOM elements to build a spreadsheet like data grid
with text output and cells for setpoint input.
with the idea to make a interactive design tool ( with 3D show )
at start and every change that setpoints are used in a calculation function,
to prepare data ( array.. ) for the drawing
and text ( in variables ) for documentation ( like instructions & BOM lists )
+ in a HTML text paragraph ( under processing canvas and operation DOM elements )
+ also printed to browser console and
+ offered as download file / with date/time of change in filename.
pls. find that template for play or edit
-2- when i made a tutorial for processing here i also learned that on GITLAB i can put not only the source code public, also i can run a web page via gitlab.io, that version is here
so using above 3D template for a specialized job ( teaching and design tool for friends), but also develop it in a team ( gitlab group member ), i wanted to use GITLAB again, but had a hard time to use that 'page' feature (again).
so here the short steps to it:
to serve a html 'page' using gitlab.io
-1- make a new group mygroup
-2- make a new project mytool inside the group mygroup
-3- with ( minimal content )
- - a subdir /public/ and
- - therein a file index.html with a line: ":)"
-4- rename in mytool:settings that new project from mytool to mygroup.gitlab.io
-5- make/copy the file
-6- start CI/CD pipeline, if running wait...
-7- call your new website via browser: https://mygroup.gitlab.io/mytool/
i used some unwanted naming and not dare to repair it...
but it should be possible to clean up the whole thing.
-3- other problem is that i never did a real GIT
even i used GITHUB and GITLAB from the browser sometimes,
uploaded (drop) a few files, downloaded 'projects' as zip...
so now i need to learn how to use that online gitlab repository
( just filled with the P5.js template )
for real team project work ( with issues, revisions ... )
and learn GIT from RPI terminal..
there i work in a /public/ directory of a node server app
having all files /public/... open using the GEANY IDE tabs ( at GEANY startup
/ even without any 'geany project' declared )
and test in LAN PC with browser...
now there it would be good if with a GIT PUSH i could send all back to GITLAB
but if you google/search GITLAB and Raspberry Pi
its all about installing a GITLAB server on the RPI...
that is NOT what i want here:
-a- i have a ( free plan ) GITLAB account at gitlab.com
-b- i have made a GROUP and a PROJECT ( here a webpage )
( and its public serving 'page' as https://GROUP.gitlab.io/PROJECT already. )
-c- so what i want to do as a start would be to CLONE that repository to the RPI, develop and test there and push commit it back to gitlab.
-d- and there are members in that group ( role: developer ) what also might test and work on it,
so need we a revision system, that's what GIT is for.
lets startup the RPI and try:
-a- i make a test subdirectory under my node server app
and from there:
$ git --version
git version 2.20.1
so GIT is default installed now on ( new named ) 'Raspberry Pi OS'
while cat /etc/issue.net here still say 'Raspbian'
Raspbian GNU/Linux 10
DEBIAN buster
Linux version 4.19.118-v7
Raspberry Pi 3 Model B Plus Rev 1.3
DEBIAN buster
Linux version 4.19.118-v7
Raspberry Pi 3 Model B Plus Rev 1.3
now you could use HTTPS way
git config --global user.name "your_username"
git config --global user.email "your_email_address@example.com"
git config --global --list
but
Authenticating via SSH is GitLab’s recommended method
next on RPI ( at /home/pi/ ) i try:
ssh-keygen -t rsa -b 2048 -C "email@example.com" ( using the email i used at GITLAB )
give a file name like 'gitlab_sshkeys', but no passphrase?
it does NOT put the files into /home/pi/.ssh/id_rsa/, i found them at /home/pi/
so i created dirs and moved that stuff.
now at GITLAB click on you avatar / User settings / SSH keys /
and paste the content of the file 'gitlab_sshkeys_pub'
but when i try
ssh -T git@gitlab.com
i could add the HOST but get a error about the key files...
pi@RPI3:~ $ ssh -T git@gitlab.com
The authenticity of host 'gitlab.com (172.65.251.78)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.com,172.65.251.78' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/home/pi/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/pi/.ssh/id_rsa": bad permissions
git@gitlab.com: Permission denied (publickey).
pi@RPI3:~ $
The authenticity of host 'gitlab.com (172.65.251.78)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.com,172.65.251.78' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/home/pi/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/pi/.ssh/id_rsa": bad permissions
git@gitlab.com: Permission denied (publickey).
pi@RPI3:~ $
____
ok, cleaned up on both sides and try again follow this
looks better:
pi@RPI3:~ $ mkdir .ssh
pi@RPI3:~ $ cd .ssh
pi@RPI3:~/.ssh $ touch authorized_keys
pi@RPI3:~/.ssh $ chmod 700 ~/.ssh
pi@RPI3:~/.ssh $ chmod 600 ~/.ssh/authorized_keys
pi@RPI3:~/.ssh $ ssh-keygen -t rsa -b 2048 -C "MY_EMAIL@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/pi/.ssh/id_rsa): [ENTER]
Enter passphrase (empty for no passphrase): [ENTER]
Enter same passphrase again: [ENTER]
Your identification has been saved in /home/pi/.ssh/id_rsa.
Your public key has been saved in /home/pi/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:______ MY_EMAIL@gmail.com
The key's randomart image is:
+---[RSA 2048]----+
+----[SHA256]-----+
pi@RPI3:~/.ssh $ cat id_rsa.pub >> authorized_keys
___________
now on GITLAB click on your avatar / User settings / SSH keys /
and copy/paste the content of the RPI file "authorized_keys"
and use a name like here RPI3, to identify the device the key is from.
___________
back on RPI:
pi@RPI3:~/ $ ssh -T git@gitlab.com
The authenticity of host 'gitlab.com (172.65.251.78)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.com,172.65.251.78' (ECDSA) to the list of known hosts.
Welcome to GitLab, @MY_NAME!
pi@RPI3:~/ $
and try to CLONE:
git clone git@gitlab.com:MY_GROUP/MY_PROJECT.git
now i work locally on RPI3 and modify a file
README.md
and play until that changes are directly at the GITLAB repository
git config --global user.email "MY_EMAIL@gmail.com"
git config --global user.name "MY_NAME"
using the GITLAB account data,
i needed that to get the commit working, but i am disappointed,
why now that thing with email and name config was required
as the clone worked via SSH? possibly later i will learn where i took the wrong turn...
git status
git add README.md ( or git add . )
git commit -m "update README.md from RPI3"
git push origin master
and update webpage and find new file content ( with last commit msg and time )
while for GITLAB online good material here,
RPI working GIT is usually from terminal, with command lines
( or watch youtube )
from the start i copy all testing of git commands into a log file so i can look what i try already.
but for a better integration ( as i use Raspberry Pi OS desktop ( slim version ) )
i want know how other people work?
+ + install apps?
here i try first GIGGLE
but not work with it until now...
sudo apt install giggle

+ + try to integrate into the often used IDE: GEANY
try plugin geany plugin vc
sudo apt install -y geany-plugin-vc
but first we got stuck on a 'how to' question:
the job of a developer ( what is not the owner )
would be to do modifications locally on a ?clone?branch? of the project
test it and then upload it again and tell the owner that a mod is ready for ?merge.
so that is the very basic of GIT teamwork
( and the reason to use GIT and not just send zip files per email to each other )
why is it so difficult with GIT to get a hang on it.
-a- first the info what the role permission differences are: here
well i can change the master protection so a developer can push to it ( overwrite )
but that was not the idea of a 'hierarchical' team?
-b- i do have a other login to gitlab ( but that was where i used the github login button ) ( for a project about processing tutorial )
first i used that again to login to gitlab
in a other browser login with OWNER login and allow group member email of above login to be developer, and that get a invitation email.
but there is a warning i can not use HTTPS commit.. until i give a new?extra password.
after that i have to change the login to email / password style ( not use the github button )
-c- as there i am now a developer i open a new branch ( of the project in question )
i could download / clone that to the RPI too, but only with the configured owner access...
i not want to do that, because it is about to play with the developer account...
here i use the chance to work from the win 10 PC:
-d- so play GIT on windows..
i try the https://git-scm.com/download/win and get Git-2.27.0-64-bit.exe 48MB
but first install npp.7.8.8.Installer.x64.exe from npp as used editor

-e- in git linux command window MINGW64:
walk old style
cd X:
cd /path/to/GIT/project/
.1 need now user.name and user.email config same EMAIL
.2 when start clone first time the credential manager run
need email & password from gitlab login ( username not worked )
if wrong get HTTP Basic: Access denied
to change must go:
windows / control panel / credential manager / generic credentials / git:https://gitlab.com / EDIT ( or REMOVE to get asked again )
git clone -b BranchName https://gitlab.com/MyGroup/MyProject.git
yes, took me an hour to get that:
but now can start work locally ( win10 PC ) on that branch

well, i not even find HOW to edit a file there
( oh yes, in GIT-bash nano .. works,
but actually i install and configure npp as GIT file editor...
but where / how to call it? all very frustrating, but my fault as i look at it as a IDE ,
but it is a GIT tool only, so possibly a file edit has to be done outside?
-f- ok,
- - use nano to change info file,
- - GIT GUI : rescan / stage / commit / push
and its in the correct repository / branch ONLINE at GITLAB
-g- now i do ONLINE ( as developer ) a merge request
-h- open a issue to inform also other developers
-i- and as owner a merge incl. delete branch...
-j- make a tag / revision / release out of it
and download ( as ZIP ) to check that release contains that changes...
OUR TEAM IS IN BUSINESS