Git backup always pushes local master branch and cannot synchronize multiple OPNsense nodes to the same repository
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.2k
- Forks
- 863
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 10
Description
- I have read the contributing guidelines
- I have checked for existing issues
- AI tools were used to help draft this report.
Model used:
- ChatGPT (GPT-5.5)
Extent of AI involvement:
- Wording only. All testing, logs and analysis were performed manually.
Describe the bug
The Git Backup plugin assumes that the local repository always contains a branch named master and only performs a one-way push.
This causes two related problems:
- The plugin cannot initialize a second OPNsense installation against an already populated repository ("git out of sync").
- The plugin never fetches or rebases from the remote before pushing, so multiple firewalls cannot share the same repository.
This makes the plugin unusable for HA pairs or multiple firewalls that should keep their configuration history in one Git repository.
Environment
- OPNsense 26.x
- os-git-backup 1.1_3
Steps to reproduce
- Configure Git Backup on firewall A.
- Push successfully to an empty GitHub repository.
- Configure the same repository on firewall B.
- Click "Backup now".
Actual behavior
The backup fails with
git out of sync
The local repository never synchronizes with the remote.
The implementation only executes
git push origin master:
without performing a fetch/pull/rebase beforehand.
Expected behavior
The plugin should be able to use an existing repository.
A possible workflow would be:
git fetch origin
git checkout
git rebase origin/
git push origin HEAD:
or another synchronization strategy.
This would allow multiple OPNsense installations (for example HA clusters) to safely share one repository.
Additional observations
During testing I also noticed that the plugin hardcodes the local source branch to master:
git push origin master:<configured branch>
This also breaks repositories whose local branch is named main.
Using HEAD:<configured branch> instead would avoid depending on a specific local branch name.
Please have a look into the related bug:
Git backup plugin has multiple issues when configured for GitHub over SSH.
opnsense/core#10670
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Git Backup plugin code that constructs git push origin master:<configured branch> and review how it handles the configured branch and remote synchronization. Reproduce the two-firewall workflow against a populated repository, then verify that the chosen synchronization strategy and branch-independent push resolve the "git out of sync" failure without breaking existing backups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, php
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100