sync-auth
Bidirectional auth credential sync for dev tools via Git repositories.
Sync authentication credentials for developer tools (GitHub CLI, GitLab CLI, Claude Code, Codex, Gemini CLI, and more) through a Git repository. Works in containers, CI runners, and across machines.
Problem
Developers using AI coding tools and platform CLIs need to re-authenticate in every new container, CI runner, or machine. There's no universal way to sync these credentials.
Features
- Bidirectional sync -- local credentials to/from a Git repository
- 7 built-in providers:
gh,glab,claude,codex,gemini,opencode,qwen-coder - Extensible -- add custom providers by implementing the
AuthProvidertrait - Conflict resolution -- skips expired/dead tokens, prefers fresher credentials
- Shallow clone -- fast initial setup with
--depth 1 - Watch mode -- continuous monitoring and periodic sync
- Daemon support -- start/stop/restart as background process or systemd service
- CI/CD ready -- usable in GitHub Actions, GitLab CI, Docker containers
- Config file + env vars -- TOML config with CLI/env override support
Supported Providers
| Provider | Tool | Credential paths |
|---|---|---|
gh |
GitHub CLI | ~/.config/gh/ |
glab |
GitLab CLI | ~/.config/glab-cli/ |
claude |
Claude Code | ~/.claude/, ~/.claude.json |
codex |
OpenAI Codex CLI | ~/.codex/ (auth.json, config.toml) |
gemini |
Gemini CLI | ~/.gemini/ (.env, oauth_creds.json) |
opencode |
Opencode | ~/.local/share/opencode/, ~/.config/opencode/ |
qwen-coder |
Qwen Code | ~/.qwen/ (oauth_creds.json, settings.json) |
Quick Start
Install
Initialize config
# Edit ~/.config/sync-auth/config.toml with your repo URL
Basic usage
# Pull credentials from remote repo
# Push local credentials to remote repo
# Bidirectional sync
# Sync only specific providers
# Watch mode (sync every 60 seconds)
# Check status
# List available providers
Environment variables
All CLI options can be set via environment variables:
Daemon mode
# Start as background daemon
# Stop daemon
# Restart
# Print systemd service unit for permanent installation
Library Usage
use ;
async
Custom provider
use ;
;
Configuration
Config file location: ~/.config/sync-auth/config.toml
# Git repository URL (required)
= "https://github.com/USER/credentials.git"
# Providers to sync (empty = all)
= ["gh", "claude", "glab"]
# Git branch
= "main"
# Use shallow clone for initial setup
= true
# Watch mode interval (seconds)
= 60
Docker / CI Usage
GitHub Actions
- name: Sync credentials
run: |
cargo install sync-auth
sync-auth --repo ${{ secrets.CREDENTIALS_REPO }} pull
Docker (with link-foundation/sandbox)
# On host: push credentials
# In container: pull credentials
Architecture
sync-auth
├── Library crate (sync_auth)
│ ├── AuthProvider trait -- extensible provider system
│ ├── GitBackend trait -- pluggable storage backend
│ ├── SyncEngine -- orchestrates sync operations
│ ├── SyncConfig -- TOML-based configuration
│ └── providers/ -- built-in providers (gh, claude, etc.)
└── CLI binary (sync-auth)
└── Thin wrapper over the library with clap-based CLI
Prior Art
- link-assistant/claude-profiles -- Node.js CLI that syncs Claude credentials via GitHub Gists (Claude-only, size-limited)
Development
Contributing
See CONTRIBUTING.md for guidelines.
License
Unlicense -- Public Domain