1.2 KiB
1.2 KiB
Backup to Gitea
This folder contains a PowerShell script to snapshot the repository and push the snapshot into a Gitea backup repository.
Quick steps
- On your Gitea server create a repository for backups (for example username/dslr-director-backups). Make it private if desired.
- Create a personal access token in Gitea for your user with repository push permissions.
- From the repository root run (PowerShell):
$GITEA_URL = 'https://gitea.example.com'
$GITEA_USER = 'youruser'
$GITEA_TOKEN = 'YOUR_TOKEN'
.\scripts\backup_to_gitea.ps1 -GiteaUrl $GITEA_URL -GiteaUser $GITEA_USER -GiteaToken $GITEA_TOKEN -BackupRepo "youruser/dslr-director-backups"
What the script does
- Clones the backup repo into a temporary directory (or pulls latest if already present).
- Creates a timestamped folder under
snapshots/and copies the project files there (skips.gitand virtual environments). - Commits and pushes the snapshot to the backup repo using the provided credentials.
Notes
- The script uses
robocopyfor directory copy on Windows. Make sure Git and robocopy are available in PATH. - The script uses HTTPS pushes with credentials in the URL. Keep your token secret.
- You can schedule this script as a Windows Scheduled Task to run nightly.