
An encrypted Git remote helper implemented in rust
THIS IS AN EXPERIMENTAL PROJECT, there hasnt been a formal security audit. DO NOT rely on this for any critical repositories.
git-remote-pqcrypt is an encrypted Git remote helper similar to gcrypt. It stores Git packfiles and repository metadata encrypted at rest. Access is with post-quantum XWing wrapping.
Current crate version: 0.2.0.
git-remote-pqcrypt init creates a repository master key.git-remote-pqcrypt remote helper.Example files of remote storage:
keys.json
manifest.enc
objects/
pack-.....pack.enc
keys.json contains metadata and encrypted master key wrappings.
Install the default build from Git:
cargo install --git https://github.com/Torm0r/git-remote-pqcrypt --locked
This installs git-remote-pqcrypt to Cargo's binary directory, usually ~/.cargo/bin.
Make sure Cargo's binary directory is in your PATH, then check that it works:
git-remote-pqcrypt --help
The default build includes local filesystem and Git-backed storage support.
To install with SFTP support on Unix-like systems:
cargo install --git https://github.com/Torm0r/git-remote-pqcrypt --locked --features sftp
The sftp feature is currently not supported on Windows.
Build with default backend support:
cargo build --release
This includes local filesystem and Git-backed storage support.
To build with SFTP support on Unix-like systems:
cargo build --release --features sftp
Install the binary to your PATH:
sudo cp target/release/git-remote-pqcrypt /usr/local/bin/
The binary name must remain git-remote-pqcrypt, because Git finds remote helpers by looking for git-remote-[name].
Check that it works:
git-remote-pqcrypt --help
git must be installed--features sftp and is currently Unix-like onlyGo to an existing Git repository or make one.
Initialize pqcrypt storage.
Local path:
git-remote-pqcrypt init pqcrypt:///path/to/encrypted-store
SFTP requires building with the sftp feature and is currently supported only on Unix-like systems:
git-remote-pqcrypt init pqcrypt::sftp://[email protected]/path/to/store
Git-backed:
git-remote-pqcrypt init pqcrypt::[email protected]:org/store.git
If no private key exists, one is generated at ~/.config/pqcrypt/key and the public key is printed.
You will be prompted for an optional key comment, for example personal or work-laptop.
After init, a Git remote named pqcrypt is added:
git remote -v
Example:
pqcrypt pqcrypt::/path/to/encrypted-store (fetch)
pqcrypt pqcrypt::/path/to/encrypted-store (push)
git push pqcrypt main
git clone pqcrypt::[email protected]:Torm0r/pqcrypt-test.git my-clone
They must generate a keypair with:
git-remote-pqcrypt keygen
They can get their public key with:
git-remote-pqcrypt pubgen ~/.config/pqcrypt/key
Or they can copy the public key printed by keygen.
Then an existing authorized user adds them to the repository:
git-remote-pqcrypt add-user <base64-public-key>
Run this for more options:
git-remote-pqcrypt add-user -h
By default, add-user looks for a local Git remote whose URL starts with pqcrypt and adds the public key there.
pqcrypt distinguishes normal pushes from force pushes by the Git refspec.
Normal pushes are fast-forward checked and rejected if they would overwrite remote history.
Git invokes pqcrypt as a remote helper through the git-remote-pqcrypt binary.
When invoked by Git, the helper expects the remote-helper argument shape used by Git, for example:
git-remote-pqcrypt origin pqcrypt::/path/to/store
Direct CLI subcommands such as init, add-user, keygen, pubgen, and help are treated as normal user commands, not remote-helper invocations.
The binary entrypoint delegates to the library runtime, so the application logic is testable through the crate library as well as through the installed binary.
For Git-backed storage URLs, pqcrypt maintains a local cache under the system cache directory, for example:
~/.cache/pqcrypt/
pqcrypt fetches encrypted state from the backing Git repository before operations and pushes encrypted state after updates.
If cache corruption or cache loss is detected, pqcrypt attempts to recreate the cache automatically by refetching from the backing Git repository.
pqcrypt::, pqcrypt://, and pqcrypt: are all accepted and normalized internally to pqcrypt::.
These are equivalent:
git-remote-pqcrypt init pqcrypt:///path/to/store
git-remote-pqcrypt init pqcrypt::/path/to/store
git-remote-pqcrypt init pqcrypt:/path/to/store
Backend is determined by the storage path:
Examples:
pqcrypt::/tmp/store
pqcrypt:///tmp/store
pqcrypt:/tmp/store
pqcrypt::[email protected]:org/store.git
pqcrypt::https://github.com/org/store.git
pqcrypt::sftp://[email protected]/path/to/store
During decryption pqcrypt looks for a private key in this order:
PQCRYPT_KEY_PATH environment variablegit config pqcrypt.keypath.pqcrypt/key in the current directory~/.config/pqcrypt, where all are testedFor multi-key setups, for example work and personal keys:
git config pqcrypt.keypath ~/.config/pqcrypt/work-key
The key must be one that was used during init or added via add-user.
Run the full test suite:
cargo test
Run with SFTP enabled on Unix-like systems:
cargo test --features sftp
Some end-to-end tests that depend on Unix-like local path behavior are ignored on Windows.
GitHub Actions builds the project on Linux, macOS, and Windows. Workflow artifacts may contain binaries from CI runs, but these are not official releases.
XChaCha20Poly1305.XWing.0600 permissions on Unix-like systems.sftp feature and is currently not supported on Windows.ssh and git must be installed.| Pattern | Backend | Notes |
|---|
/local/path | Local filesystem | Default |
git@host:, *.git, https://git* | Git-backed | Default |
sftp:// or ssh:// | SFTP | Requires --features sftp; Unix-like systems only |