- Created
.gitignoreat root level - Added
.envto.gitignore - Added
.env.localto.gitignore - Added
.env.*.localto.gitignore - Created
agent/.env.examplewith placeholder values - Created
frontend/.env.examplewith safe defaults - Verified actual
.envfiles are ignored by git
- Added
*.dbto.gitignore - Added
*.db-journalto.gitignore - Added
agent/agent_histories/to.gitignore - Verified
backend/data/unit.dbis ignored
- No real API keys in committed files
- Only placeholder keys in
.env.examplefiles - OpenAI API key is in
.env(ignored) - No hardcoded secrets in source code
- Added
__pycache__/to.gitignore - Added
node_modules/to.gitignore - Added
venv/and virtual environment folders - Added
.next/build directory
- Added
.vscode/to.gitignore - Added
.DS_Storeto.gitignore - Added IDE-specific files
git clone <repo-url>
cd unitAgent (.env):
cd agent
cp .env.example .env
# Edit .env and add your OpenAI API keyFrontend (.env.local):
cd frontend
cp .env.example .env.local
# Defaults should work, but adjust if needed- Always use
.env.exampleas a template - Never commit actual
.envfiles - If you accidentally commit a secret:
- Immediately revoke/rotate the key
- Remove from git history using
git filter-branchor BFG Repo-Cleaner - Force push (if working on a branch)
agent/.envfrontend/.env.local- Any
.env.*files
backend/data/*.dbagent/agent_histories/*.json- Any
*.dbor*.sqlitefiles
node_modules/__pycache__/.next/venv/,env/,.venv/
.vscode/.DS_Store*.swp,*.swo
Before committing, always verify:
# Check git status
git status
# Verify no .env files are staged
git status | grep ".env"
# Search for potential secrets in staged changes
git diff --cached | grep -i "sk-proj-"
git diff --cached | grep -i "api[_-]key"
# Check what's being ignored
git status --ignored | grep -E "\.env|\.db|agent_histories"If you accidentally commit a secret:
-
Immediately revoke the secret
- For OpenAI: https://platform.openai.com/api-keys
-
Remove from git history
# Using BFG Repo-Cleaner (recommended) bfg --replace-text passwords.txt # Or using git filter-branch git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch path/to/file" \ --prune-empty --tag-name-filter cat -- --all
-
Force push (if already pushed)
git push --force --all
-
Notify team members to rebase their branches
Run these before making the repository public:
# Check for common secret patterns
git grep -i "api[_-]key" -- . ':!*.example' ':!SECURITY.md'
git grep -i "sk-proj-" -- . ':!*.example' ':!SECURITY.md'
git grep -i "password" -- . ':!*.example' ':!SECURITY.md'
# Verify .env files are ignored
git check-ignore agent/.env frontend/.env.local
# Check staging area
git ls-files | grep -E "\.env$|\.db$"All commands should return empty or confirm files are ignored.