Skip to content

SSH keys provide secure authentication for Git operations. Use them for cloning, pushing, and pulling from Kizuna repositories.

Generating SSH Keys

bash
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/kizuna

RSA (Legacy)

bash
ssh-keygen -t rsa -b 4096 -C "[email protected]" -f ~/.ssh/kizuna

Adding Keys to Kizuna

Via Web UI

  1. Copy public key:

    bash
    cat ~/.ssh/kizuna.pub
  2. Go to SettingsSSH Keys

  3. Click New SSH Key

  4. Paste the public key

  5. Add a descriptive title (e.g., "Work Laptop")

  6. Click Add

Via API

bash
curl -X POST /api/v1/user/ssh-keys \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Work Laptop",
    "key": "ssh-ed25519 AAAAC3NzaC... [email protected]"
  }'

Configuring SSH

SSH Config

Edit ~/.ssh/config:

Host kizuna
    HostName kizuna.example.com
    User git
    IdentityFile ~/.ssh/kizuna
    IdentitiesOnly yes

Using the Config

bash
# Clone using config
git clone kizuna:org/repo.git

# Or explicit URL
git clone [email protected]:org/repo.git

Multiple Keys

Different Keys for Different Accounts

# ~/.ssh/config
Host kizuna-work
    HostName kizuna.example.com
    User git
    IdentityFile ~/.ssh/kizuna-work

Host kizuna-personal
    HostName kizuna.example.com
    User git
    IdentityFile ~/.ssh/kizuna-personal

Clone with specific key:

bash
git clone kizuna-work:work-org/project.git
git clone kizuna-personal:personal-org/project.git

Testing SSH Connection

bash
ssh -T [email protected]

# Expected response:
# Hi username! You've successfully authenticated...

Key Management

List Your Keys

bash
curl /api/v1/user/ssh-keys \
  -H "Authorization: Bearer $TOKEN"

Delete a Key

bash
curl -X DELETE /api/v1/user/ssh-keys/123 \
  -H "Authorization: Bearer $TOKEN"

Key Requirements

  • Minimum 2048 bits (RSA)
  • Ed25519 preferred
  • Unique per user (no sharing)

Troubleshooting

Permission Denied

bash
# Test SSH agent
ssh-add -l

# Add key to agent
ssh-add ~/.ssh/kizuna

# Test connection
ssh -vT [email protected]

Wrong Key Being Used

bash
# Specify key explicitly
ssh -i ~/.ssh/kizuna [email protected]

# Or use IdentitiesOnly in config

Key Already in Use

Each key can only be added to one account. Generate a new key if needed.

Security Best Practices

  1. Use Ed25519 — Modern, secure, fast
  2. Password protect keys — Use passphrase
  3. Unique per device — Don't copy keys
  4. Rotate regularly — Update every 6-12 months
  5. Remove old keys — Clean up unused keys

Agent SSH Keys

Agents also use SSH for Git operations:

  1. Generate key for agent
  2. Add as deploy key to repository (read-only)
  3. Or add to agent's user account

See Deploy Keys for agent-specific keys.

Summary

SSH keys provide:

  • Secure authentication — No passwords in URLs
  • Convenience — No token entry for each operation
  • Multi-factor — Combine with key passphrase
  • Audit trail — Track which key performed actions

They're the recommended authentication method for regular Git operations.