nh commands, configure the CLI to point at your NervesHub server and authenticate your identity. Configuration is stored in ~/.nh by default and can be overridden per-command with global flags or environment variables — making it straightforward to switch between NervesCloud, a staging server, and a self-hosted instance.
Authentication
Authenticate with NervesHub using your preferred method. After authenticating,nh stores a session token in its local config directory.
nh user login for interactive workstations where a browser is available. In automated pipelines, set the NERVES_HUB_TOKEN environment variable instead of calling a login command (see Environment Variables below).
The browser flow opens a page on your NervesHub instance (for example
https://manage.nervescloud.com/auth/cli/<token>) where you confirm the session. The CLI then stores the resulting token locally.Set the Server URI
nh defaults to the NervesCloud managed service at https://manage.nervescloud.com/. If you are running a self-hosted NervesHub instance, update the URI:
--uri.
Set Default Org and Product
Avoid typing--org and --product on every command by setting defaults:
Environment Variables
All configuration values can be supplied as environment variables. This is the recommended approach for CI/CD pipelines and containerized environments.nh recognizes both NERVES_HUB_* and NERVES_CLOUD_* prefixes as aliases for every variable.
When the same value is set both in the config file and as an environment variable, the environment variable takes precedence. Command-line flags override both.
Configuration Profiles
Use named profiles to maintain separate configurations for different environments — for example,production, staging, and local. Profiles are saved to and loaded from the CLI data directory.
Save the current configuration to a named profile:
View Current Config
Print the full current configuration — including the active server URI, org, product, and config file path — with:Global Flags
Everynh command accepts the following flags, which override the corresponding config file or environment variable values for that single invocation:

