Skip to content
Contact Us

Command Cheat Sheet

Quick reference for the most common MirthSync commands. Print this page for a handy desk reference.


First-time setup
# Install MirthSync globally
npm install -g mirthsync
# Create project directory
mkdir my-mirth-project && cd my-mirth-project
# Set password (avoids command-line exposure)
export MIRTHSYNC_PASSWORD="your-password"
# Initialize with first pull
mirthsync -s https://server:8443/api -u admin -t . pull
# Initialize Git repository
mirthsync -t . git init
mirthsync -t . git add
mirthsync -t . --commit-message "Initial commit" git commit

Sync with server
# Pull latest from server
mirthsync -s https://server:8443/api -u admin -t . pull
# Push changes to server
mirthsync -s https://server:8443/api -u admin -t . push
# Push and deploy channels individually
mirthsync -s https://server:8443/api -u admin -t . -d push
# Push and deploy ALL channels at once
mirthsync -s https://server:8443/api -u admin -t . --deploy-all push
Version control
# Check status
mirthsync -t . git status
# View changes
mirthsync -t . git diff
# Stage and commit
mirthsync -t . git add
mirthsync -t . --commit-message "Your message" git commit
# Push to remote
mirthsync -t . git push
# Pull from remote
mirthsync -t . git pull

Feature branches
# List branches
mirthsync -t . git branch
# Switch to existing branch
mirthsync -t . git checkout main

Multiple environments
# Pull from dev environment
mirthsync -s https://mirth-dev:8443/api -u admin -t ./dev-config pull
# Pull from production environment
mirthsync -s https://mirth-prod:8443/api -u admin -t ./prod-config pull
# Push to staging environment
mirthsync -s https://mirth-staging:8443/api -u admin -t ./staging-config push

OptionShortDescription
--server-sServer URL (https://host:8443/api)
--username-uAdmin username
--target-tLocal directory path (required)
--deploy-dDeploy changed channels individually
--deploy-allDeploy all channels at once
--force-fForce overwrite
--ignore-cert-warnings-iIgnore SSL certificate warnings

Secure password handling
# Set password (avoids command-line exposure)
export MIRTHSYNC_PASSWORD="your-password"
# Then run commands without password prompt
mirthsync -s https://server:8443/api -u admin -t . pull

Terminal window
# 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 reset
Terminal window
# Pull from both environments to different directories
mirthsync -s https://dev:8443/api -u admin -t ./dev-config pull
mirthsync -s https://prod:8443/api -u admin -t ./prod-config pull
# Compare with diff tool
diff -r ./dev-config ./prod-config
Terminal window
# Quick backup with timestamp
mirthsync -s https://server:8443/api -u admin -t . pull
mirthsync -t . git add
mirthsync -t . --commit-message "Backup $(date +%Y-%m-%d)" git commit
mirthsync -t . git push

GitHub Actions example
# 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 }}
Docker usage
# Run MirthSync in Docker
docker run -v $(pwd):/data sagait/mirthsync pull -s https://server:8443/api -u admin -t /data

Common fixes
# Connection refused - check URL format
mirthsync -s https://server:8443/api -u admin -t . pull # Include /api
# SSL certificate errors
mirthsync -s https://server:8443/api -u admin -i -t . pull
# Authentication failed - check credentials
mirthsync -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 debugging
mirthsync -s https://server:8443/api -u admin -v -t . pull

my-mirth-project/
├── Channels/
│ └── Group Name/
│ └── Channel Name/
│ ├── channel.xml
│ └── *.js (transformers)
├── CodeTemplates/
│ └── Library Name/
│ └── template.xml
├── GlobalScripts/
├── Resources/
└── ServerConfiguration/