Hi All
I have a selfhosted Gitea server, and I use it for a lot more than coding. I even do management of document history for my business. I love it.
What I would like to do, is use it backup specific folders on other servers in my homelab.
Say for example my webdev test server: I would like to daily back up /etc/ /var/www/one.example.com/ /var/www/two.example.com/ etc etc
Now my knowledge on Gitea, and Git as a whole, is relatively limited to clone, add, commit, push and pull.
If I setup a user for the server, then insert the ssh pub key. I would like to know, how from the terminal (via SSH to the server), I can create a new repo for folder /var/www/one.example.com/ and then do an initial commit, so that the .git folder is created locally in /var/www/one.example.com/.git/
Then I can set a cronjob to do my daily backups, but still have the magic of full file history.
Also, can you configure a Repo to only keep changes back for say 90 days? (Space saving in the long run).
I know there are a lot of ways to do this, but I have a very good reason for using Git, mainly, it streamlines restoring files at any point in history, and also if I need to fork a website I am developing, I can do it in Git with ease.
Plus it allows me to add other users to a repo for example, and allows us to do branches etc.
Currently I am backing everything up using a script I wrote, and I have a dedicated bare metal that is handling that. I get a .tar.gz for the last 7 days, the last 5 sundays and the last 3 months (1st). But this is starting to take up a lot of harddrive space.
Any advice would kindly be appreciated.
You can use gitea actions to run any command on any server you like. Starting backups, running git pull or push… endless possibilities