SSH Keys
SSH keys provide secure, passwordless authentication for git operations (push, pull, clone) over SSH. When you add an SSH public key to your JJHub account, JJHub’s SSH server matches the key fingerprint on every connection, letting you interact with any repository you have access to without entering a password or token.Why SSH Keys
- No passwords: Once your key is registered, git operations authenticate automatically. No credentials to type, paste, or rotate.
- Strong cryptography: SSH keys use public-key cryptography. Your private key never leaves your machine — only the public key is stored on JJHub.
- Works everywhere: SSH is supported by every major operating system and git client, including jj’s git backend.
- Multiple keys: You can register multiple SSH keys on your account — one per machine, one per role, or however you prefer to organize access.
Supported Key Types
JJHub accepts the following SSH key types:| Key Type | Algorithm | Minimum Size | Recommended |
|---|---|---|---|
| Ed25519 | EdDSA | Fixed (256-bit) | Yes — fastest, most secure, smallest key size |
| ECDSA | ECDSA | 256-bit | Acceptable |
| RSA | RSA | 2048-bit | Acceptable (4096-bit preferred if using RSA) |
Generating an SSH Key
If you already have an SSH key you want to use, skip to Adding Your SSH Key to JJHub.macOS and Linux
Open a terminal and run:~/.ssh/id_ed25519). When prompted for a passphrase, enter a strong passphrase (recommended) or press Enter for no passphrase.
This creates two files:
~/.ssh/id_ed25519— your private key (never share this)~/.ssh/id_ed25519.pub— your public key (this is what you add to JJHub)
~/.ssh/config to load keys from Keychain automatically:
Windows
Using Git Bash or WSL: The same commands from the macOS/Linux section work in Git Bash and WSL:Using RSA (if Ed25519 is unavailable)
Some older systems do not support Ed25519. In that case, generate an RSA key with at least 4096 bits:~/.ssh/id_rsa and ~/.ssh/id_rsa.pub.
Adding Your SSH Key to JJHub via CLI
Copy your public key and add it using thejjhub ssh-key add command:
| Flag | Description |
|---|---|
-t, --title <text> | Human-readable title for the key (required) |
-k, --key <key> | SSH public key string (required) |
Adding Your SSH Key via API
You can also register SSH keys through the JJHub API directly:400— Missing required fields (title,key)401— Not authenticated409— Key already exists on your account422— Invalid SSH public key format or unsupported key type
Listing Your SSH Keys
Via CLI
Via API
Deleting an SSH Key
Via CLI
jjhub ssh-key list.
Via API
204 No Content on success.
Testing Your SSH Connection
After adding your key, verify that JJHub recognizes it:Permission denied error, see Troubleshooting below.
Using SSH with jj
Once your SSH key is registered, you can clone, push, and pull repositories over SSH.Cloning a repository
Pushing changes
Setting SSH as your default protocol
If you want the CLI to always generate SSH clone URLs:Multiple SSH Keys
If you use multiple JJHub accounts (for example, a personal account and a work account), or if you want to use different keys for different hosts, configure SSH to select the right key automatically.SSH Config for Multiple Accounts
Edit~/.ssh/config to define host aliases:
IdentitiesOnly yes directive ensures SSH only offers the specified key, preventing the agent from trying other keys and hitting authentication failures.
Testing a specific key
Troubleshooting
Permission denied (publickey)
This means JJHub’s SSH server did not accept any of the keys your SSH client offered. Check that your key is added to JJHub:-v) shows which keys SSH is offering and whether the server accepts them. Look for lines like Offering public key and Server accepts key.
Wrong key being used
If you have multiple keys and SSH is offering the wrong one, use an SSH config file to specify which key to use for JJHub:IdentitiesOnly yes directive prevents the SSH agent from offering other keys.
SSH agent not running
Ifssh-add -l returns Could not open a connection to your authentication agent, the SSH agent is not running.
macOS/Linux:
Key format not supported
JJHub accepts Ed25519, ECDSA, and RSA (2048+ bits) keys. If you receive a422 error when adding a key, check:
- The key is a public key (not the private key). Public key files end in
.pub. - The key format is supported. DSA keys and RSA keys smaller than 2048 bits are rejected.
- The key string is complete and has not been truncated. Public keys are a single line — make sure no line breaks were introduced when copying.
Connection timeout
Ifssh -T ssh.jjhub.tech hangs without responding:
- Check that your firewall or corporate network allows outbound SSH connections (port 22).
- Try connecting on an alternate network to rule out network-level blocking.
- Verify DNS resolution:
nslookup ssh.jjhub.techshould return an IP address.
SSH Keys vs Other Authentication Methods
| Method | Scope | Protocol | Best For |
|---|---|---|---|
| Personal SSH keys | All repos the user can access | SSH (git push/pull) | Developer workstations |
| Deploy keys | Single repository | SSH (git push/pull) | CI/CD, deployment scripts |
| API tokens | Scoped by token permissions | HTTPS (API calls) | Programmatic API access, scripts |
| JJHUB_TOKEN | Scoped by token permissions | HTTPS (CLI API calls) | CI environments without SSH |
API Reference
| Method | Endpoint | Description |
|---|---|---|
GET | /api/user/keys | List SSH keys on your account |
POST | /api/user/keys | Add an SSH key |
GET | /api/user/keys/:id | Get an SSH key |
DELETE | /api/user/keys/:id | Delete an SSH key |