Based on [istepanov/backup-to-git], adapted for ARM64 platforms with a patched command.sh and crontab.
This container periodically backs up files from a mounted folder into a remote Git repository.
- Install Docker and Docker Compose
- Have a GitHub account
- Create a GitHub repository to store your backups (e.g.
my-backup-repo)
The container needs permission to push commits to your backup repository.
- Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click Generate new token (classic)
- Give it a name like
docker-backup - Select scopes:
repo→ full control of private repositoriesworkflow(optional, only if you want to push workflow files)
- Generate the token and copy it somewhere safe.
⚠️ You won’t be able to see it again.
This project uses a .env file to keep secrets out of your compose.yaml.
- Copy the example file:
cp .env.example .env
- Open
.envin your editor and replace the placeholders:
# Daily backup identity
GIT_NAME_DAILY=Backup-Daily
GIT_EMAIL_DAILY=your-github-email@example.com
GIT_URL_DAILY=https://<your-username>:<your-personal-access-token>@github.com/<your-username>/<your-daily-repo>.git
# Monthly backup identity
GIT_NAME_MONTHLY=Backup-Monthly
GIT_EMAIL_MONTHLY=your-github-email@example.com
GIT_URL_MONTHLY=https://<your-username>:<your-personal-access-token>@github.com/<your-username>/<your-monthly-repo>.git- Replace
<your-username>with your GitHub username - Replace
<your-personal-access-token>with the PAT you created - Replace
<your-daily-repo>and<your-monthly-repo>with the names of your backup repositories
The compose.yaml defines two services: one for daily backups and one for monthly backups.
-
Start the containers:
docker compose up -d
-
Check logs:
docker compose logs -f git-backup-daily
-
Stop the containers:
docker compose down
If you want to run a backup immediately without cron scheduling:
docker run --rm \
--env-file .env \
-v /path/to/data:/target:ro \
ghcr.io/<your-username>/docker-backup-to-git-arm64 no-cron.envshould never be committed to Git — it contains secrets. Only commit.env.example.- The container defaults to pushing to the
mainbranch. - Commit messages include a UTC timestamp by default.
.
├── Dockerfile
├── command.sh
├── crontab
├── compose.yaml
├── .env.example
└── README.md