Alesvetina
Posts: 2
Joined: Fri Sep 13, 2019 10:44 am

Git pull in Raspbian on boot on multiple Raspberry PI-s

Fri Sep 13, 2019 10:48 am

Hello!

I have multiple Raspberry Pis which I hand out to multiple people. On each of them there is a local html file, which was cloned on each PI from Gitlab.

What is the best way to update this file (probably on boot) for all users, when I make some changes to the file? I guess each PI has to have a ssh key so it can pull automatically. Then do I run a git pull script when Raspbian boots? What is the best way to do that?

Also, I would only like the PIs to pull the code, the users cannot be able to make changes and push the code back on Gitlab.

Thank you for your opinions and have a nice day!

User avatar
topguy
Posts: 5762
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Git pull in Raspbian on boot on multiple Raspberry PI-s

Fri Sep 13, 2019 2:15 pm

Also, I would only like the PIs to pull the code, the users cannot be able to make changes and push the code back on Gitlab
Since you will be handing out these Pi's there is nothing you can do to really prevent anyone from accessing any keys used against GitLab.
But you should maybe create a user in GitLab that only have "read" access, then maybe even password authentication would be good enough.

Running the update in "/etc/rc.local" is doable, it will run as user root so ssh-keys for root are in "/root/.ssh" ( I believe )
Also because you are running as root you might need to adjust access rights after update, but you will see during testing.

Alesvetina
Posts: 2
Joined: Fri Sep 13, 2019 10:44 am

Re: Git pull in Raspbian on boot on multiple Raspberry PI-s

Sat Sep 14, 2019 8:54 am

Thank you for your reply.
I was thinking. On boot, the raspberry may not have internet connection.
Is it possible to run a .sh script which pulls from git, when the raspberry connects to wifi? Listen to a "connected to wifi" event?

Thank you!

Return to “Beginners”