Git backup always pushes local master branch and cannot synchronize multiple OPNsense nodes to the same repository
incomplete
- [x] I have read the contributing guidelines
- [x] I have checked for existing issues
- [x] 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:
1. The plugin cannot initialize a second OPNsense installation against an already populated repository ("git out of sync").
2. 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
1. Configure Git Backup on firewall A.
2. Push successfully to an empty GitHub repository.
3. Configure the same repository on firewall B.
4. 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:<configured branch>
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 <branch>
git rebase origin/<branch>
git push origin HEAD:<branch>
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`:
```php
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
1 条评论