Command Cheat Sheet
MirthSync Command Cheat Sheet
Section titled “MirthSync Command Cheat Sheet”Quick reference for the most common MirthSync commands. Print this page for a handy desk reference.
Setup & Configuration
Section titled “Setup & Configuration”# Install MirthSync globallynpm install -g mirthsync
# Create project directorymkdir my-mirth-project && cd my-mirth-project
# Set password (avoids command-line exposure)export MIRTHSYNC_PASSWORD="your-password"
# Initialize with first pullmirthsync -s https://server:8443/api -u admin -t . pull
# Initialize Git repositorymirthsync -t . git initmirthsync -t . git addmirthsync -t . --commit-message "Initial commit" git commit# Download MirthSync JARcurl -L -o mirthsync.jar https://github.com/SagaHealthcareIT/mirthsync/releases/latest/download/mirthsync.jar
# Create project directorymkdir my-mirth-project && cd my-mirth-project
# Set password (avoids command-line exposure)export MIRTHSYNC_PASSWORD="your-password"
# Initialize with first pulljava -jar mirthsync.jar -s https://server:8443/api -u admin -t . pull
# Initialize Git repositoryjava -jar mirthsync.jar -t . git initjava -jar mirthsync.jar -t . git addjava -jar mirthsync.jar -t . --commit-message "Initial commit" git commitDaily Workflow
Section titled “Daily Workflow”Pull & Push
Section titled “Pull & Push”# Pull latest from servermirthsync -s https://server:8443/api -u admin -t . pull
# Push changes to servermirthsync -s https://server:8443/api -u admin -t . push
# Push and deploy channels individuallymirthsync -s https://server:8443/api -u admin -t . -d push
# Push and deploy ALL channels at oncemirthsync -s https://server:8443/api -u admin -t . --deploy-all pushGit Operations
Section titled “Git Operations”# Check statusmirthsync -t . git status
# View changesmirthsync -t . git diff
# Stage and commitmirthsync -t . git addmirthsync -t . --commit-message "Your message" git commit
# Push to remotemirthsync -t . git push
# Pull from remotemirthsync -t . git pullBranching
Section titled “Branching”# List branchesmirthsync -t . git branch
# Switch to existing branchmirthsync -t . git checkout mainEnvironment Management
Section titled “Environment Management”# Pull from dev environmentmirthsync -s https://mirth-dev:8443/api -u admin -t ./dev-config pull
# Pull from production environmentmirthsync -s https://mirth-prod:8443/api -u admin -t ./prod-config pull
# Push to staging environmentmirthsync -s https://mirth-staging:8443/api -u admin -t ./staging-config pushCommon Options
Section titled “Common Options”| Option | Short | Description |
|---|---|---|
--server | -s | Server URL (https://host:8443/api) |
--username | -u | Admin username |
--target | -t | Local directory path (required) |
--deploy | -d | Deploy changed channels individually |
--deploy-all | Deploy all channels at once | |
--force | -f | Force overwrite |
--ignore-cert-warnings | -i | Ignore SSL certificate warnings |
Environment Variables
Section titled “Environment Variables”# Set password (avoids command-line exposure)export MIRTHSYNC_PASSWORD="your-password"
# Then run commands without password promptmirthsync -s https://server:8443/api -u admin -t . pullQuick Tasks
Section titled “Quick Tasks”Rollback to Previous Version
Section titled “Rollback to Previous Version”# View commit history (get commit hash from here)mirthsync -t . git log
# Reset to specific commit (use full commit hash from git log)mirthsync -t . git reset --hard abc123def456...
# Soft reset (keeps changes staged)mirthsync -t . git reset --soft abc123def456...
# Reset staging area (unstage all)mirthsync -t . git resetCompare Environments
Section titled “Compare Environments”# Pull from both environments to different directoriesmirthsync -s https://dev:8443/api -u admin -t ./dev-config pullmirthsync -s https://prod:8443/api -u admin -t ./prod-config pull
# Compare with diff tooldiff -r ./dev-config ./prod-configBackup Current State
Section titled “Backup Current State”# Quick backup with timestampmirthsync -s https://server:8443/api -u admin -t . pullmirthsync -t . git addmirthsync -t . --commit-message "Backup $(date +%Y-%m-%d)" git commitmirthsync -t . git pushCI/CD Integration
Section titled “CI/CD Integration”# In your workflow file- name: Pull Mirth Config run: | curl -L -o mirthsync.jar https://github.com/SagaHealthcareIT/mirthsync/releases/latest/download/mirthsync.jar java -jar mirthsync.jar -s ${{ secrets.MIRTH_URL }} -u ${{ secrets.MIRTH_USER }} -t . pull env: MIRTHSYNC_PASSWORD: ${{ secrets.MIRTH_PASSWORD }}
# Deploy to production- name: Push to Production run: java -jar mirthsync.jar -s ${{ secrets.PROD_URL }} -u ${{ secrets.MIRTH_USER }} -t . -d push env: MIRTHSYNC_PASSWORD: ${{ secrets.MIRTH_PASSWORD }}# Run MirthSync in Dockerdocker run -v $(pwd):/data sagait/mirthsync pull -s https://server:8443/api -u admin -t /dataTroubleshooting
Section titled “Troubleshooting”# Connection refused - check URL formatmirthsync -s https://server:8443/api -u admin -t . pull # Include /api
# SSL certificate errorsmirthsync -s https://server:8443/api -u admin -i -t . pull
# Authentication failed - check credentialsmirthsync -s https://server:8443/api -u admin -t . pull # Will prompt for password
# Reset local changes (unstage all)mirthsync -t . git reset
# Verbose output for debuggingmirthsync -s https://server:8443/api -u admin -v -t . pullFile Structure Reference
Section titled “File Structure Reference”my-mirth-project/├── Channels/│ └── Group Name/│ └── Channel Name/│ ├── channel.xml│ └── *.js (transformers)├── CodeTemplates/│ └── Library Name/│ └── template.xml├── GlobalScripts/├── Resources/└── ServerConfiguration/Related Resources
Section titled “Related Resources”- Full CLI Reference - Complete command documentation
- Installation Guide - Detailed setup instructions
- Glossary - Term definitions