Overview
Theportless 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
The service name to construct a URL for. Uses the same naming logic as
portless run including git worktree detection.Options
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.
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 branchauth:
Skip Worktree Detection
Force the base URL without worktree prefix:Wiring Services Together
Useportless 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
Theportless get command:
- Discovers state - Reads the proxy port and configuration
- Applies worktree logic - Detects if you’re in a git worktree and prepends the branch name as a subdomain
- Constructs URL - Builds the complete
.localhostURL - 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
| Feature | portless get | portless list |
|---|---|---|
| Purpose | Construct URL for any name | Show active routes |
| Checks if running | No | Yes |
| Output format | Plain URL only | Formatted table |
| Git worktree aware | Yes | No |
| Use in scripts | Yes (stdout only) | No (formatted output) |
Error Handling
Missing Service Name
Missing service name.
Solution: Provide a service name as the first argument.
Unknown Flag
Unknown flag "--unknown".
Solution: Use only supported flags: --no-worktree, --help
Related Commands
portless run
Run a service with auto-inferred name
portless list
Show all active routes
Git Worktrees
Learn about worktree detection