Oli4
Posts: 10
Joined: Sun Jun 02, 2019 9:01 am

Git server

Thu Jun 06, 2019 6:37 pm

I'm new to git and github, I only know the basic commands and how to use it, so I don't really know any server side stuff.

What I'm looking for is that a directory on my pi is in sync is with my git repository, so when I commit something from my pc it's automaticly on the pi

My proposals are:
1) host a git server on the pi
2) make a script that clones or pulls the repository every x minutes

I hope a someone can help me and give a solution, thx

DirkS
Posts: 9897
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Git server

Thu Jun 06, 2019 7:25 pm

I think https://gogs.io/ can do that.
There are probably others.

User avatar
DougieLawson
Posts: 35779
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Git server

Thu Jun 06, 2019 7:49 pm

The locally hosted git server is easy https://gitolite.com/gitolite/index.html

The automatic sync is not so easy.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Greg Erskine
Posts: 115
Joined: Sat Sep 15, 2012 4:20 am

Re: Git server

Thu Jun 06, 2019 11:24 pm

hi Oli4,

I use WinSCP on my PC as "the view" for my RPi development. Left hand pane are the files on my PC git directory, and the right pane are the files on my RPi. WinSCP allows you to sync in either direction.

Double-click on a file in the RPi pane and Notepad++ opens the file. Do your edits and click save and it updates on the RPi. Test program on RPi. When you are happy, do a WinSCP sync local and the changed files are copied to the PC's git directory. At the appropriate time push to GitLab.

I have a backup script on the RPi to backup the files. Also a "rcp" script to copy files to other RPi's on my network.

There are a few gotchas to work out.

1. Unix/DOS EOL - WinSCP, Notepad++ and SmartGit automatically handle this but it takes a while to work out.

2. Time stamps need to be co-ordinated between PC and RPi. Daylight saving sometimes causes issues.

3. If you leave your PC for a while the connection to the RPi is dropped. You need to enter your password numerous times to restore connection.

This process seems logical and works for me, but the other guys in our team think I'm crazy!!! YMMV.
* Raspberry Pi is a trademark of the Raspberry Pi Foundation

Return to “Networking and servers”