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
.gitsdirectory, 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_DIRandGIT_WORK_TREEset via environment variables. - Automatic Exclusion: During
gits init,.gitsis automatically added to the main repo's.git/info/excludefile. - No Trace in Main Repo: The main repo's
.gitignoreand.git/info/excludeensure secrets and the.gitsdirectory 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
.gitignoreas well for extra safety. - Never expose
.gitsor 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