connect up command starts the Private Connect agent, authenticates with the hub, and prepares your system to expose and reach services.
Usage
Options
Hub server URL to connect to
API key for authentication. If not provided, will use device authorization flow.
Human-readable label for this agent (e.g., “alex-macbook”)
Optional friendly name for the agent
Pre-authenticated token (for CI/CD). Can also be set via
PRIVATECONNECT_TOKEN environment variable.Path to custom config file
First-Time Setup
On first run,connect up will:
- Authenticate using device authorization flow
- Generate a unique agent ID
- Save configuration to
~/.privateconnect/config.json - Set up the daemon (optional)
- Configure DNS settings (macOS)
- Prompt to expose your first service
Interactive Authentication
Using an API Key
CI/CD Mode
For automated environments:Behavior
Existing Configuration
If you’ve already authenticated,connect up will:
- Use the existing configuration
- Register with the hub
- Connect via WebSocket
- Stay running in the foreground
Zero-Touch Setup
On macOS and Linux,connect up automatically:
- Installs the daemon for background operation
- Configures DNS resolution for
.localhostdomains (macOS) - Prompts to expose your first service
Token Expiry Handling
If your stored credentials are invalid or expired:- Clear stale configuration
- Restart device authentication
- Save new credentials
Examples
Basic Setup
Custom Label
Self-Hosted Hub
With Custom Name
Configuration File
After runningconnect up, configuration is stored at:
- macOS/Linux:
~/.privateconnect/config.json - Windows:
%USERPROFILE%\.privateconnect\config.json
Exit Codes
0- Agent connected successfully1- Authentication failed, network error, or invalid credentials
Related Commands
connect daemon- Manage background daemonconnect expose- Expose services after connectingconnect reach- Access remote services
Troubleshooting
Connection Errors
If you see connection errors:- Your internet connection
- Hub URL is correct
- Firewall settings allow outbound connections
Invalid Token
If authentication fails:- Clear the config:
rm ~/.privateconnect/config.json - Re-authenticate:
connect up