中文 | English
autogit is a high-performance Git repository auto-backup daemon built with C++20 coroutines. It monitors file changes in a specified directory in real time, automatically commits and pushes changes to a remote Git server, providing unattended continuous backup.
- Automatically detects file changes (new, modified, deleted, renamed, type changed)
- Automatically stages all changed files (
git add) - Automatically creates commits and pushes to remote Git server
- Supports force push mode
- Native file system event notifications per platform:
- Linux: inotify
- macOS: FSEvents
- Windows: ReadDirectoryChangesW
- Instant response to file changes without polling
- Configurable polling fallback interval
- SSH key authentication: Custom public/private key paths and passphrase
- HTTP/HTTPS authentication: Username/password support
- Automatically adapts to remote repository authentication
- Auto-initializes Git repository if target directory is not yet a repo
- Automatically configures remote URL
- Supports initial commit for empty repositories
- Native LFS Pointer Support: Automatically detects patterns configured as
filter=lfsin.gitattributes - Automatic Clean/Smudge Filtering: Uses libgit2's
git_filtermechanism — automatically replaces large files with pointer files on staging and restores them on checkout - Flexible Pattern Configuration: Supports LFS file patterns via
.gitattributesand command-line--lfs_pattern(glob wildcards) - HTTP Batch API Upload: Pushes LFS objects directly to remote servers via LFS Batch API
- Configurable Push URL: Supports a dedicated LFS push URL via
--lfs_push_url - LFS Server: The companion LFS server can be avplayer/httpd
- Command-line arguments and configuration file (
autogit.conf) support - Custom commit messages
- Custom Git author name and email
- Configurable check interval
- Quiet mode (disable logging)
- Configurable log directory
- Dockerfiles for both Alpine and Ubuntu bases
- Static linking for small image size
- Ready-to-use containerized deployment
- Linux, macOS, Windows — fully compatible
- CMake build system with Ninja support
- GCC, Clang, MSVC compiler support
- ccache build cache support
git clone https://github.com/jackarain/autogit.git
cd autogit
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja
ninjaThe executable will be at build/bin/autogit.
Monitor an existing Git repository and back it up automatically:
autogit --repository /path/to/your/repo \
--git_remote_url https://github.com/user/repo.git \
--git_author "Your Name" \
--git_email "your@email.com"autogit --repository /path/to/your/repo \
--git_remote_url git@github.com:user/repo.git \
--ssh_privkey /path/to/id_rsa \
--ssh_pubkey /path/to/id_rsa.pub[Unit]
Description=Auto Git Backup Daemon
After=network.target
[Service]
ExecStart=/usr/local/bin/autogit --repository /path/to/repo --check_interval 60
WorkingDirectory=/tmp/
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetdocker build -t autogit -f Dockerfile .
docker run -d \
-v /path/to/repo:/data \
autogit --repository /data --quiet true| Option | Default | Description |
|---|---|---|
--repository |
— | Path to the Git repository to watch |
--config |
autogit.conf |
Path to configuration file |
--check_interval |
60 |
Check interval in seconds |
--commit_msg |
— | Custom commit message; auto-generated based on time if not specified |
--force_push |
false |
Enable force push |
--git_author |
— | Git commit author name |
--git_email |
— | Git commit author email |
--git_remote_url |
— | Remote repository URL; used to set the remote when initializing a new repo; if remote.origin.url is already configured, the config file takes priority |
--http_username |
— | HTTP auth username |
--http_password |
— | HTTP auth password |
--ssh_pubkey |
— | SSH public key path |
--ssh_privkey |
— | SSH private key path |
--ssh_passphrase |
— | SSH key passphrase |
--quiet |
false |
Quiet mode (suppress logging) |
--log_dir |
— | Log file directory |
--lfs |
false |
Enable Git LFS support; files matching LFS patterns in .gitattributes will be stored as pointers |
--lfs_pattern |
— | Additional LFS file patterns (glob), e.g. --lfs_pattern '*.psd' --lfs_pattern '*.zip'; multiple patterns can also be separated by ; in a single argument, e.g. --lfs_pattern '*.iso;*.mmdb;*.bin' |
--lfs_push_url |
— | LFS remote URL for pushing objects; has lower priority than config files (.lfsconfig, .git/lfsconfig, .git/config); only takes effect when lfs.url is not set in those files |
autogit is built on the following core technologies:
- C++20 Coroutines — Boost.Asio
awaitable-based asynchronous I/O and coroutine control flow - libgit2 — Pure C Git core operations library, no Git CLI dependency
- Boost Libraries — Asio (networking & async), Filesystem (file system), Program Options (argument parsing)
- watchman Module — Cross-platform file system event monitoring abstraction layer
- gitpp — Modern C++ RAII wrapper around libgit2 (located in
incubator/gitpp/) - httpc — C++20 coroutine-based HTTP client library built on Boost.Beast and Boost.Asio (located in
third_party/httpc/), with SSL support, connection reuse, and streaming request/response
This project is open source under the Boost Software License 1.0.