This guide explains how to use SSH key authentication in Deploy Center for accessing private Git repositories securely.
- Overview
- Security Architecture
- Generating SSH Keys
- Adding Keys to Git Platforms
- Key Rotation
- Troubleshooting
Deploy Center supports deploying from private Git repositories using SSH key authentication. This is more secure than using passwords and is required for private repositories on GitHub, GitLab, and Bitbucket.
Benefits:
- ✅ No password storage needed
- ✅ More secure than HTTPS with credentials
- ✅ Automated access without user intervention
- ✅ Can be revoked independently
- ✅ Audit trail for key usage
When to use:
- Private repositories
- Organizations requiring SSH-only access
- Enhanced security requirements
- Automated CI/CD pipelines
Deploy Center implements a zero-trust approach to SSH key management:
Storage:
- Private keys encrypted with AES-256-GCM before storing in database
- Encryption uses the
ENCRYPTION_KEYfrom your.envfile - Public keys stored in plain text (safe to expose)
Encryption Details:
- Algorithm: AES-256-GCM (Galois/Counter Mode)
- Key derivation: PBKDF2 with 100,000 iterations
- Unique IV (Initialization Vector) per encryption
- Authentication tag for integrity verification
Temporary Key Files:
- Private key never stored permanently on filesystem
- Decrypted in-memory only during deployment
- Temporary key file created with strict permissions (0600)
- File deleted immediately after Git operation
- Automatic cleanup on process exit or crash
Security Flow:
┌─────────────────────┐
│ Encrypted Database │
│ (AES-256-GCM) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Decrypt in Memory │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Temp File (0600) │ ← Only during deployment
│ /tmp/deploy-ssh-* │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Git Clone/Pull │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Secure Delete │ ← 3-pass overwrite
│ (DoD 5220.22-M) │
└─────────────────────┘
When temporary key files are deleted, Deploy Center uses a 3-pass secure deletion:
- Pass 1: Overwrite with random data
- Pass 2: Overwrite with zeros
- Pass 3: Overwrite with ones
- Final: Delete file
This prevents forensic recovery of key material from disk.
A background process runs every 60 seconds to:
- Find orphaned key files (older than 5 minutes)
- Securely delete abandoned keys
- Log cleanup operations
- Handle crashed deployment cleanup
- Open your project in Deploy Center
- Go to project details page
- Scroll to "SSH Key Management" section
Click "Generate SSH Key" button.
Key Type Options:
- Modern, fast, and secure
- Smaller key size (256-bit)
- Better performance
- Supported by GitHub, GitLab, Bitbucket
Select this unless:
- You have legacy systems requiring RSA
- Your Git platform doesn't support ED25519
- Traditional algorithm
- Larger key size (2048-bit or 4096-bit)
- Widely compatible
- Slower than ED25519
Select this if:
- Required by your organization
- Compatibility with older systems needed
After generation, Deploy Center displays:
Public Key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAbCdEf... deploy-center
Fingerprint: SHA256:abc123def456...
Key Type: ED25519
Created: 2026-01-04 11:30:00
Copy the public key to add to your Git platform.
The public key must be added to your Git platform as a Deploy Key.
- Go to your repository on GitHub
- Navigate to Settings → Deploy keys
- Click Add deploy key
- Fill in:
- Title:
Deploy Center - [Project Name] - Key: Paste the public key
- Allow write access: ❌ Leave unchecked (read-only is safer)
- Title:
- Click Add key
Result: GitHub shows the key as active.
- Go to your repository on GitLab
- Navigate to Settings → Repository → Deploy Keys
- Click Add key
- Fill in:
- Title:
Deploy Center - [Project Name] - Key: Paste the public key
- Expires at: Optional (set expiration if required)
- Grant write permissions: ❌ Leave unchecked
- Title:
- Click Add key
- Go to your repository on Bitbucket
- Navigate to Repository settings → Access keys
- Click Add key
- Fill in:
- Label:
Deploy Center - [Project Name] - Key: Paste the public key
- Label:
- Click Add key
For self-hosted Git servers:
-
SSH into your Git server
-
Add the public key to
~/.ssh/authorized_keys:echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5..." >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
Once the SSH key is added, update your project's repository URL to use SSH format:
HTTPS (won't use SSH key):
https://github.com/username/repository.git
SSH (uses SSH key):
git@github.com:username/repository.git
How to change:
- Go to project details
- Click Edit Project
- Update Repository URL to SSH format
- Save changes
Deploy Center automatically tests the SSH connection during the first deployment:
Success:
✅ Git clone successful using SSH key
Failure:
❌ Permission denied (publickey)
If you see a failure, check:
- Public key added to Git platform correctly
- Repository URL is in SSH format
- Key hasn't been revoked
- Git platform user has repository access
Regularly rotating SSH keys is a security best practice.
Recommended:
- Every 90 days for production
- After team member leaves
- If key may have been compromised
- During security audits
Required:
- If private key leaked
- If encryption key changed
- If key suspected to be compromised
- Go to project details
- In "SSH Key Management" section
- Click "Regenerate SSH Key"
- Select key type (ED25519 or RSA)
- Confirm regeneration
- Copy the new public key
- Go to your Git platform (GitHub/GitLab/etc.)
- Delete the old deploy key
- Add the new deploy key (see Adding Keys)
- Trigger a manual deployment
- Monitor logs for SSH connection
- Verify successful clone/pull
Deploy Center tracks key rotation:
Created: 2025-12-01 10:00:00
Last Rotated: 2026-01-04 11:30:00
Rotation Count: 2
If you no longer need SSH authentication:
- Go to project details
- In "SSH Key Management" section
- Click "Delete SSH Key"
- Confirm deletion
This will:
- Delete encrypted private key from database
- Remove public key reference
- Disable SSH authentication
- Require switching back to HTTPS URL
- Go to your Git platform
- Navigate to Deploy Keys section
- Delete the corresponding key
Why both?
- Deploy Center can't access your Git platform
- Unused keys should be removed from Git platform for security
Cause: Git server rejects SSH connection.
Solutions:
-
Verify public key is added to Git platform:
- Check GitHub/GitLab Deploy Keys section
- Ensure key matches exactly (no extra spaces)
-
Verify repository URL uses SSH format:
- Should be
git@github.com:user/repo.git - Not
https://github.com/user/repo.git
- Should be
-
Regenerate SSH key:
- Old key may be corrupted
- Follow Key Rotation steps
-
Check Git platform permissions:
- User must have read access to repository
- Organization policies may block deploy keys
Cause: Encryption key mismatch.
Solutions:
-
Check ENCRYPTION_KEY in .env:
# Verify key exists and is 64 hex characters echo $ENCRYPTION_KEY
-
If ENCRYPTION_KEY changed:
- All existing SSH keys are now unreadable
- Must regenerate all SSH keys
- Update Git platforms with new public keys
Cause: Temporary key file was deleted prematurely.
Solutions:
-
Retry deployment:
- Usually a transient issue
- System will recreate temporary file
-
Check disk space:
df -h /tmp
-
Check temporary directory permissions:
ls -la /tmp | grep deploy-center-ssh
Cause: Git server's host key not in known_hosts.
Solutions:
Deploy Center disables strict host key checking for deployments, so this error is rare.
If it occurs:
-
SSH into Deploy Center server manually
-
Clone repository once to accept host key:
ssh git@github.com # Type 'yes' when prompted
- Use ED25519 keys for better security and performance
- Rotate keys every 90 days for production projects
- Delete unused keys from both Deploy Center and Git platforms
- Use read-only deploy keys (don't grant write access)
- Test deployments immediately after key rotation
- Document key rotation in your deployment logs
- Use unique keys per project for better isolation
- Monitor key usage in deployment logs
- Don't share private keys between projects
- Don't grant write access to deploy keys unless absolutely necessary
- Don't skip key rotation after team changes
- Don't reuse keys from other systems
- Don't store private keys anywhere else
- Don't modify
ENCRYPTION_KEYwithout regenerating all keys - Don't use SSH keys for public repositories (HTTPS is simpler)
- Creating Projects - Project setup guide
- Deployment Workflows - How deployments work
- Webhook Setup - Configuring webhooks
Need Help? Join our Discord community or open an issue.