Git Integration

Native Git integration in Polycrate based on go-git: status, add, commit, pull, push, sync, auto_commit in polycrate.yml, and how it relates to SDD releases.

Polycrate includes native Git integration built on go-git that works without a local git installation and automatically uses the workspace SSH key (artifacts/secrets/id_rsa).

Available Commands

All commands exist under polycrate git as well as aliases under polycrate workspace:

polycrate git Alias under workspace Description
polycrate git status — Branch, commit, and staged, unstaged, and untracked files
polycrate git add <path\|--all> polycrate workspace add Stage changes for commit
polycrate git commit -m "..." polycrate workspace commit Create a commit
polycrate git pull polycrate workspace pull Fetch remote changes with upfront conflict checking
polycrate git push polycrate workspace push Push local commits to the remote
polycrate git sync polycrate workspace sync Stage → Commit → Pull → Push in one step

Typical Daily Workflow

# 1. Fetch latest state from remote
polycrate git pull

# 2. Test and apply changes
polycrate run my-app install

# 3. Encrypt secrets before committing
polycrate workspace encrypt

# 4. Review changes and sync
polycrate git status
polycrate git add --all
polycrate git commit -m "feat: update app configuration"
polycrate git push

For a quick full sync after encrypted changes:

polycrate git sync

Optional auto_commit

If you want Polycrate to automatically create a commit after every successful action, enable auto_commit in your global CLI configuration ~/.polycrate/polycrate.yml (not in workspace.poly):

# ~/.polycrate/polycrate.yml
auto_commit: true

SSH Authentication for Git

polycrate git authenticates using the file-based workspace SSH key at artifacts/secrets/id_rsa (independent of the host SSH agent). On an encrypted workspace, decrypt first or use standard git with your personal SSH key when committing the workspace in its encrypted state.

Troubleshooting

Error Solution
Authentication failed Verify that artifacts/secrets/id_rsa exists (chmod 600) and its public key is configured on the Git host
Local changes would be overwritten Commit local changes before running polycrate git pull
UNENCRYPTED secrets detected Run polycrate workspace encrypt before committing

See Also