Skip to main content

Overview

The portless get command constructs and prints the URL for a service using the same hostname and worktree logic as portless run, without actually starting the service. This is useful for wiring services together or passing URLs as environment variables.

Syntax

Parameters

string
required
The service name to construct a URL for. Uses the same naming logic as portless run including git worktree detection.

Options

boolean
Skip git worktree prefix detection and use only the base name. Useful when you want the plain URL regardless of which worktree you’re in.
boolean
Show help information for the get command.

Examples

Basic Usage

Get the URL for a service:

In a Git Worktree

When run from a linked worktree on branch auth:

Skip Worktree Detection

Force the base URL without worktree prefix:

Wiring Services Together

Use portless get to pass URLs as environment variables:

Use Cases

Environment Variables

Pass service URLs to applications that need to communicate with other portless services

Scripts

Build shell scripts that reference portless service URLs without hardcoding

CI/CD

Generate URLs in automation workflows that mirror local development setup

Documentation

Display service URLs in documentation or help messages

How It Works

The portless get command:
  1. Discovers state - Reads the proxy port and configuration
  2. Applies worktree logic - Detects if you’re in a git worktree and prepends the branch name as a subdomain
  3. Constructs URL - Builds the complete .localhost URL
  4. Prints to stdout - Outputs only the URL (no extra formatting) so it can be captured in shell variables
portless get does not check if the service is actually running. It simply constructs what the URL would be if the service were running with that name.

Comparison with portless list

Error Handling

Missing Service Name

Error: Missing service name. Solution: Provide a service name as the first argument.

Unknown Flag

Error: Unknown flag "--unknown". Solution: Use only supported flags: --no-worktree, --help

portless run

Run a service with auto-inferred name

portless list

Show all active routes

Git Worktrees

Learn about worktree detection