gits
is a Rust CLI tool that enables developers to version-control sensitive files (like .env
) in a completely separate Git repository (.gits
) within their project, without affecting or leaving any trace in the main repository.
- Separate Repository: All sensitive files are tracked in a
.gits
directory, not.git
. This repo is fully independent and invisible to the main project repo. - Full Git CLI Support: Transparently supports all Git commands (add, commit, log, status, etc.) for the secrets repo.
- Environment Variable Control: All Git subprocesses are invoked with
GIT_DIR
andGIT_WORK_TREE
set via environment variables. - Automatic Exclusion: During
gits init
,.gits
is automatically added to the main repo's.git/info/exclude
file. - No Trace in Main Repo: The main repo's
.gitignore
and.git/info/exclude
ensure secrets and the.gits
directory remain untracked and invisible to collaborators.
cargo install --path .
Or install from crates.io:
cargo install gits
# First, make sure you're in a git repository
git init
# Then initialize the gits repository
gits init
# Add sensitive files
gits add .env
# Commit changes
gits commit -m "Add environment variables"
# View status
gits status
# View history
gits log
- Add sensitive files to your main repo's
.gitignore
as well for extra safety. - Never expose
.gits
or its contents in the main repo, either by tracking or by documentation.
gits
works by setting the GIT_DIR
environment variable to .gits
and GIT_WORK_TREE
to the current directory when executing Git commands. This ensures that all Git operations are performed on the separate .gits
repository while working with files in your main project directory.
MIT