Using Double Dash (--) with Coder SSH Commands
Last updated: June 25, 2026
Overview
This article explains how to use the double dash (--) separator with coder ssh commands to pass standard SSH options and flags to the underlying SSH connection.
When to Use Double Dash
The double dash (--) separates Coder-specific flags from standard SSH options that should be passed directly to the SSH command. This is essential when you need to:
- Connect to servers on non-standard ports (
-p) - Use specific SSH configuration options (
-o) - Pass other standard SSH flags that Coder doesn't recognize
Command Syntax
coder ssh -- [SSH_OPTIONS] [user@]hostname [command]
Examples
# Connect to external server on port 2222 coder ssh myworkspace -- -p 2222 user@server.example.com # Use specific SSH options coder ssh myworkspace -- -o StrictHostKeyChecking=no user@server.example.com # Execute a command on external server coder ssh myworkspace -- -p 2222 user@server.example.com "uptime" # Multiple SSH options coder ssh myworkspace -- -p 2222 -o ConnectTimeout=30 user@server.example.com
coder gitssh
coder gitssh -- [SSH_OPTIONS] [user@]hostname
Examples
# Connect to Git server on non-standard port coder gitssh -- -p 1234 git@gitlab.company.com # Use with specific SSH options coder gitssh -- -o PreferredAuthentications=publickey git@github.com
Important Notes About coder gitssh
⚠️ Primary Use Case: coder gitssh is designed specifically for Git operations and automation workflows. While it can be used for other SSH connections, this is not its intended purpose.
Recommended Usage:
- ✅ Git clone/push/pull operations
- ✅ Automated CI/CD pipelines
- ✅ Git-related scripting
- ⚠️ General SSH connections (use
coder sshinstead)
Common Use Cases
Ansible Management
# Connect to managed hosts on non-standard SSH ports coder ssh myworkspace -- -p 2222 ansible-user@prod-server.com # Test connectivity with verbose output coder ssh myworkspace -- -v -p 2222 ansible-user@prod-server.com
Git Operations on Non-Standard Ports
# Clone repository from server using non-standard SSH port coder gitssh -- -p 2222 git@git.company.com git clone ssh://git@git.company.com:2222/repo/project.git
Jump Host / Bastion Access
# Connect through jump host coder ssh myworkspace -- -J jumphost.example.com user@internal-server.com
Troubleshooting
Error: "unknown shorthand flag"
If you see an error like unknown shorthand flag: 'p' in -p, you're missing the -- separator:
❌ Incorrect:
coder ssh myworkspace -p 2222 user@server.com
✅ Correct:
coder ssh myworkspace -- -p 2222 user@server.com
Command Limitations
Both coder ssh and coder gitssh commands do not have full parity with the standard ssh command. For users who need the full functionality of SSH, create an SSH configuration with coder config-ssh.
Alternative: SSH Configuration
# Set up SSH configuration coder config-ssh --ssh-option "ForwardAgent=yes" # Then use standard SSH ssh user@server.example.com
Reference
- Official Documentation: ssh | Coder Docs
- External Auth for Git Providers | Coder Docs
- SSH Configuration: Use
coder config-ssh --helpfor configuration options
Related Articles
- Setting up SSH Agent Forwarding
- Configuring Coder Workspaces for Ansible
- Git Integration with Coder Workspaces