Pointing the git backup plug to a local gitea instance

Hi All, can anyone let me know what I would need to change to point the git plug to a local gitea instance?

I have had a look around but I cant quite get it working unfortunately so any help would be super appreciated.

Many thanks

The git plug (or Git space lua implementation that will likely succeed it) simply runs git commit, git pull and git push commands. If you configure git properly so that running these commands push to gitea (or anywhere else) it should all work.

Are you running SB in a docker container? Then you have to figure out how to configure it to do authentication without ssh keys etc. so this works inside the container. Github allows you to use private api keys + https URLs. Not sure how this works in Gitea.

If you run SB as a binary, the git commands will just run as whatever the server process runs in.

2 Likes

Thanks for getting back to me, this is in docker and when inside the container I am able to push while providing credentials or a url which includes credentials so I can see it is working. I will keep doing some tinkering to see if I can get it working with the plug/space lua :+1:

1 Like

I think the issue I am having is that the git commands that are being called from the git.md page (I cloned from your gist) are not able run correctly. When running the git sync the container logs show the below:
image
Running a git status from the container shows that files are still pending to be added


Running the same add/commit commands from inside the silverbullet container however appears to work

Does anyone have any thoughts on what may be causing this or what I could test next? Sorry still wrapping my head around the migration so might be missing something obvious.

I ended up working round this, set up application access token in gitea with access to the repo and git remote add origin https://user:[email protected]/repo. I then made a script on the docker host and ran this every 5 mins via crontab. Still confused why the space-lua does not do what I am after but hopefully it helps someone.

#!/bin/bash
CONTAINER="silverbullet"
REPO_PATH="/space"

# Check if container is running
if docker ps --filter "name=^/${CONTAINER}$" --filter "status=running" | grep $CONTAINER > /dev/null; then
    docker exec $CONTAINER sh -c "cd $REPO_PATH && git commit -a -m 'Auto Snapshot $(date)' && git pull && git push"
fi

What does the shell.run return when you try to run a add & commit?

Sorry how do I check this?

Sorted in the end!
Permissions issue :face_exhaling:

1 Like