Gitpod sports a command line interface that is available in each workspace terminal called
Command line interface for Gitpod Usage: gp [command] Available Commands: help Help about any command init Create a new .gitpod.yml file open Opens a file in Gitpod preview Opens a URL in Theia's preview view url Prints the URL of this workspace forward-port Makes a port available on 0.0.0.0 so that it can be exposed to the internet Flags: -h, --help help for gp Use "gp [command] --help" for more information about a command.
Gitpod workspaces can be configured - see Configuring Workspaces for more details.
gp init helps creating this configuration by guiding through this process and producing a
gitpod.yml in the end (think
Modern editors/IDE’s sport command line tooling to open a file (e.g. VS Code
code foo.txt). In Gitpod this can be done using
gp open <filename>.
We have also added common aliases for
gp preview is similar to
gp open, except that it does not open a file in the editor but a URL in a preview pane on the right.
Gitpod workspaces can expose services to the internet.
gp url provides the URL which points to a service served from a Gitpod workspace. For example
gp url 8080 prints the URL which points to the service listening on port 8080 in this current workspace.
You can combine the
url command to open a certain path instead of the default URL.
gp preview $(gp url 3000)my/path/index.html
If you put this into the
.gitpod.yml to open the a certain page on startup, don’t forget to ignore the default action when the port opens.
In Gitpod services/servers running on a port need to be exposed before they become accessible from the internet. This process only works with services listening on
0.0.0.0 and not just
Sometimes it is not possible to make a server listen on
0.0.0.0, e.g. because it is not your code and there are simply no means of configuration.
In that case,
gp forward-port <port> can be used to forward all traffic form a socket listing on all network interfaces to your process listening on localhost only.