Port sharing allows you to expose ports from your running Gitpod environment to the internet, enabling easy sharing and collaboration. This feature supports both HTTP and HTTPS communication and is available for cloud-hosted Gitpod environments not Gitpod Desktop environments.
When you share a port, Gitpod creates a public URL with automatic TLS termination. Gitpod handles incoming HTTPS connections and forwards them to your service using either HTTP or HTTPS protocol, depending on your configuration.
In the Gitpod UI, you’ll see a section labeled “Public Ports” that allows you to manage port sharing for your environment.To share a new port:
Click the “Open Port” button in the “Public Ports” section.
A dialog will appear titled “Open a public port”.
Enter a name for the port (optional) and the port number you wish to share.
Select the protocol (HTTP or HTTPS) for service communication.
Click “Open Port” to confirm.
For ports that are already open:They will be listed in the “Public Ports” section. Each open port will show its name (if given), port number, and protocol. A green indicator next to the port signifies it’s currently active and accessible.
Security notice: When you open a port, it will be available on the open internet.
Be careful when sharing the URL.
This interface provides an easy way to manage which ports are exposed from your Gitpod environment, allowing you to quickly share access to services or applications you’re running.
gitpod environment port open 8080 --name webserver
Open a port for an API server:
Copy
Ask AI
gitpod environment port open 4000 --name api
Open a port for a development server that requires HTTPS:
Copy
Ask AI
gitpod environment port open 3000 --name dev-server --protocol https
List all open ports:
Copy
Ask AI
gitpod environment port list
Close a port that’s no longer needed:
Copy
Ask AI
gitpod environment port close 4000
These CLI commands provide a quick and efficient way to manage port sharing directly from your terminal, especially useful for scripting or when you prefer command-line interactions.