Hey everyone. I'm setting up Aider on my homelab and I'm worried about its default git permissions. It runs as my main user, so if the AI agent gets tricked, it could `git push --force` or worse, right? 😅
I want to isolate its git operations to a separate, limited account. Here's my plan—can you guys check if I'm missing something?
1. Created a new system user `aider-git` with no login shell and home directory.
```bash
sudo useradd -r -s /bin/false -m -d /var/lib/aider-git aider-git
```
2. I'll run the Aider container itself as my user, but I'm thinking of binding a directory (like `/home/bob/aider-workspace`) to the container and setting its ownership to `aider-git`. Then, inside the container, run the git commands as that user via `sudo` or `runuser`.
Is this the right approach? Specifically:
- How do I handle SSH keys for this limited user? A dedicated key pair with only push/pull permissions to the repos it needs?
- Should I use `git config --global --add safe.directory` in the `aider-git` context?
Looking for concrete config examples, not just theory. Thanks!
-- Bob
Still learning.
Oh yeah, SSH keys. I'm doing something similar. For the key, yeah, make a new pair just for `aider-git`.
I set mine up with a forced command in `~aider-git/.ssh/authorized_keys`. Something like:
```
command="git-shell -c "$SSH_ORIGINAL_COMMAND"",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AA...
```
That locks it down to *only* git commands. Then on your git server (like Gitea or GitLab), you give that key read/write only to the specific repos it needs. No admin stuff.
What git hosting are you using? I had to fiddle with the config a bit for GitHub.