Page 1 of 1

Git server

Posted: Thu Jun 06, 2019 6:37 pm
by Oli4
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

Re: Git server

Posted: Thu Jun 06, 2019 7:25 pm
by DirkS
I think can do that.
There are probably others.

Re: Git server

Posted: Thu Jun 06, 2019 7:49 pm
by DougieLawson
The locally hosted git server is easy

The automatic sync is not so easy.

Re: Git server

Posted: Thu Jun 06, 2019 11:24 pm
by Greg Erskine
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.