Skip to content

A simple CLI tool to synchronize any directory with GitHub.

License

Notifications You must be signed in to change notification settings

carpe-diem/git-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitSync

Rust CI

License Rust Version dependency status

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.

Features

  • Synchronization with GitHub repositories
  • Simple configuration and setup

TODO

    • Two-way sync between local directory and remote repository
  • Support for multiple GitHub repositories.
  • Support for multiple Local directories.

Description

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.

Usage

# Initial setup
gitsync setup

# Sync your notes
gitsync sync

Installation

  1. Install Rust if you haven't already:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Clone and build the project:

    git clone [repository-url]
    cd git-sync
    cargo build --release
  3. The binary will be available at target/release/gitsync

Configuration

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

Project Structure

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

Development

Pre-commit Hooks

This project uses pre-commit hooks to ensure code quality. The hooks run:

  • cargo test: Run all tests
  • cargo fmt: Check code formatting
  • cargo clippy: Run the Rust linter

To set up pre-commit:

  1. Install pre-commit:
# macOS
brew install pre-commit

# Linux
pip install pre-commit

# Windows
pip install pre-commit
  1. 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

Building

cargo build             # Debug build
cargo build --release   # Release build

Testing

cargo test                  # Run all tests
cargo test config           # Run tests for config module only
cargo test -- --nocapture   # Run tests and show println output

Running in Development

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.

Configuración

  1. 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 y read:user)
    • Haz clic en "Generate token" y guarda el token en un lugar seguro
  2. Configura las variables de entorno:

    export GITHUB_TOKEN=tu_token_aquí

About

A simple CLI tool to synchronize any directory with GitHub.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages