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.

  • lilolalu@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    git-annex allows managing large files with git, without storing the file contents in git. It can sync, backup, and archive your data, offline and online. Checksums and encryption keep your data safe and secure. Bring the power and distributed nature of git to bear on your large files with git-annex.

    git-annex is designed for git users who love the command line. For everyone else, the git-annex assistant turns git-annex into an easy to use folder synchroniser.

    https://git-annex.branchable.com/