This project is configured to prevent accidentally committing sensitive information like:
- Pi SSH credentials (username, hostname, IP addresses)
- SSH keys
- Local environment configuration
Environment Variables: All Pi connection details are stored in .env file which is excluded from git.
Run Configurations: IntelliJ run configurations automatically source .env before executing scripts.
-
Copy the example environment file:
cp .env.example .env
-
Edit
.envwith your Pi's credentials:export PI_HOST=your-username@your-pi-hostname-or-ip export PI_PATH=/path/on/pi/to/deploy # optional
-
Update Remote Debug configuration (if using):
- Open
.run/Pi-Car Remote Debug.run.xml - Replace
your-pi-hostname-or-ipwith your actual Pi hostname/IP - This file is gitignored in the
.idea/directory
- Open
If running scripts manually from terminal:
# Source environment first
source .env
# Then run scripts
./scripts/deploy.sh
./scripts/status.sh
./scripts/stop.shThe following files are automatically excluded from git commits (in .gitignore):
.env- Your local Pi credentials.env.local- Alternative local config*.pem- SSH key files*.key- Private keysid_rsa*- SSH identity files*.ppk- PuTTY private keys
Always verify you're not committing sensitive data:
# Check what will be committed
git status
git diff
# Verify .env is not tracked
git ls-files | grep .env # Should return nothingβ Safe to commit:
.env.example- Template with placeholder values- Run configuration files (
.run/*.xml) - They reference.envbut don't contain actual credentials - Deployment scripts - They require
PI_HOSTenvironment variable
β NEVER commit:
.env- Your actual credentials- SSH keys (
*.pem,*.key,id_rsa*) - Files with hardcoded IPs, usernames, or passwords
The Remote Debug run configuration uses a placeholder hostname. To use it:
- Open IntelliJ IDEA
- Go to Run β Edit Configurations
- Select Pi-Car Remote Debug
- Replace
your-pi-hostname-or-ipwith your Pi's actual hostname or IP - Click OK (this stores it locally in
.idea/which is gitignored)
Alternatively, manually edit .run/Pi-Car Remote Debug.run.xml and replace the HOST value.
- Use SSH keys instead of passwords for Pi authentication
- Never hardcode credentials in code or scripts
- Review git diffs before committing
- Use
.envfiles for local configuration - Keep
.gitignoreupdated with sensitive file patterns
If you accidentally committed sensitive data:
# Remove from history (use with caution!)
git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch .env" \
--prune-empty --tag-name-filter cat -- --all
# Force push (only if you haven't shared the repo)
git push origin --force --allBetter yet: Rotate your credentials if they were exposed!