A simple CLI tool to synchronize any directory with GitHub. Keep your files backed up and accessible across multiple devices using Git as the synchronization mechanism.
- Synchronization with GitHub repositories
- Simple configuration and setup
-
- Two-way sync between local directory and remote repository
- Support for multiple GitHub repositories.
- Support for multiple Local directories.
GitSync is a tool designed to help you maintain your notes organized and synchronized using GitHub as a backend. It watches for changes in your local notes directory and automatically commits and pushes changes to your configured GitHub repository.
# Initial setup
gitsync setup
# Sync your notes
gitsync sync
-
Install Rust if you haven't already:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Clone and build the project:
git clone [repository-url] cd git-sync cargo build --release
-
The binary will be available at
target/release/gitsync
Run the setup command and follow the prompts:
gitsync setup
You'll need to provide:
- GitHub Personal Access Token (with repo permissions)
- GitHub repository (format: username/repo)
- Path to your directory to sync
git-sync
├── .github // GitHub Actions configuration
├── src
│ ├── main.rs // Application entry point
│ ├── config.rs // Project configuration (GitHub token, paths, etc.)
├── Cargo.toml // Project dependencies and configuration
├── README.md // Project documentation
├── .gitignore // Ignore files and directories
├── LICENSE // Project license
This project uses pre-commit hooks to ensure code quality. The hooks run:
cargo test
: Run all testscargo fmt
: Check code formattingcargo clippy
: Run the Rust linter
To set up pre-commit:
- Install pre-commit:
# macOS
brew install pre-commit
# Linux
pip install pre-commit
# Windows
pip install pre-commit
- Install the hooks:
pre-commit install
The hooks will now run automatically on every commit. You can also run them manually:
pre-commit run --all-files
cargo build # Debug build
cargo build --release # Release build
cargo test # Run all tests
cargo test config # Run tests for config module only
cargo test -- --nocapture # Run tests and show println output
cargo run -- setup # Run setup command
cargo run -- sync # Run sync command
Tests are located within each module file. For example, configuration tests can be found in src/config.rs
under the tests
module.
-
Crea un token de acceso personal de GitHub:
- Ve a https://github.com/settings/tokens
- Haz clic en "Generate new token" (Generate new token classic)
- Dale un nombre descriptivo a tu token
- Selecciona los permisos necesarios (mínimo:
repo
yread:user
) - Haz clic en "Generate token" y guarda el token en un lugar seguro
-
Configura las variables de entorno:
export GITHUB_TOKEN=tu_token_aquí