Git Sync
Git Sync connects a knowledge base directory to a remote Git repository, bringing version history and team synchronization to your Markdown documents. It’s the foundation for Moraya’s collaboration features — team review and AI review build on top of it.
Requirements
Git Sync calls your system’s git command directly, so you need Git installed on your machine. Most professional environments already have it.
Binding a knowledge base
You can connect a knowledge base to a remote in two directions:
- Clone an existing repository into a new local knowledge base.
- Init & push — turn an existing local knowledge base into a repository and push it to an empty remote.
Once bound, Moraya tracks how far your local copy is ahead of or behind the remote and surfaces sync status in the UI.
Everyday operations
| Action | What it does |
|---|---|
| Pull | Fetch and merge remote updates |
| Push | Send your local commits to the remote |
| Commit | Stage changed files and record a commit with a message |
| Status | See which files are modified, added, or deleted |
| History | Browse the commit log for the repo or a single file |
| Diff | Compare versions of a document |
Credentials & security
Access tokens are never stored in plaintext or embedded in the remote URL. Moraya keeps them in the OS keychain and injects them only for the duration of a git command via GIT_ASKPASS:
- Tokens are resolved from the keychain per operation and never written to disk in the repo.
- Git arguments are validated against a whitelist — injection-prone flags like
--upload-packand--receive-packare rejected. - Subprocess environment variables are filtered, and command output is truncated so file paths and internal details aren’t leaked.
- Operations have timeouts (clone is given longer than routine pulls and pushes).
What gets synced
Your Markdown files sync as normal. Moraya also keeps a .moraya/ directory in the knowledge base for collaboration data — review threads and lock state are shared with your team through the same repository, while machine-local artifacts (search indexes, derived rules) are excluded.