# SSH Connection Multiplexing Configuration for GitHub
# This configuration enables connection reuse across multiple git operations
# to the same host, significantly reducing connection overhead and improving performance.
#
# How it works:
# - First connection to github.com becomes the "master" connection
# - Subsequent connections reuse the master (no new KEX handshake needed)
# - Master persists for 10 minutes after last use
# - Dramatically speeds up multiple git operations (pull, push, fetch)
#
# Performance impact:
# - First operation: ~2s SSH handshake + git operation
# - Subsequent operations: ~0.1s connection reuse + git operation
# - 50%+ time savings for containers with multiple repos

Host github.com
    # Enable automatic connection multiplexing
    # First connection becomes master, others reuse it
    ControlMaster auto

    # Socket path for connection sharing
    # %C creates a hash of connection parameters (user@host:port)
    ControlPath ~/.ssh/control-%C

    # Keep master connection alive for 10 minutes after last use
    # This covers typical task execution windows
    ControlPersist 10m

    # Send keep-alive packets every 60 seconds
    # Prevents connection timeout during long operations
    ServerAliveInterval 60

    # Close connection after 3 failed keep-alive responses
    ServerAliveCountMax 3

    # Enable compression for faster data transfer
    Compression yes

    # Suppress informational messages (only show errors)
    # Prevents "ControlSocket already exists" messages during parallel git operations
    LogLevel ERROR
