Set Active JFrog CLI Server
The active server is the default target for JFrog CLI commands when you do not pass --server-id or related environment overrides. jf config use switches that default to another configured server ID. The setting is persisted in your CLI configuration file.
This topic covers the following:
Synopsis
jf config use <server-id>
Aliases: none
Where:
<server-id>: The configured server ID to make active.
Arguments
The following table lists command arguments.
| Argument | Required | Description |
|---|---|---|
server-id | Yes | The server ID to set as active |
Flags
None.
Examples
Set the Active Server
To set the active server:
-
Run the following command:
jf config use <server-id>Where:
<server-id>: The server ID to use as the default.
For example:
jf config use staging-serverExpected output:
[Info] Using server ID 'staging-server' -
To confirm the change:
Run the following command:
jf config showYou should see
staging-serverlisted asDefault: true.
Override the server for a single command or session
If you only need a different server for 1 command or for the current shell session, you do not have to change the global default.
To override the server for a single command:
-
Run the command with
--server-id. The value must be a server ID you configured withjf config add.jf rt ping --server-id=<server-id>Where:
<server-id>: The server ID to use for this invocation only.
For example:
jf rt ping --server-id=prod-serverThe
--server-idflag takes precedence over both the active server set byjf config useand theJFROG_CLI_SERVER_IDenvironment variable.
To override the server for the current terminal session:
-
Export the environment variable:
export JFROG_CLI_SERVER_ID=<server-id>Where:
<server-id>: Server ID to use until you close the shell orunset JFROG_CLI_SERVER_ID.
For example:
export JFROG_CLI_SERVER_ID=prod-server -
Run CLI commands as usual. They use
prod-serverwithout changing the active config stored byjf config use:jf rt ping
When to Use
Use jf config use when you have multiple server configurations (for example, dev-server, staging-server, prod-server) and want to switch the default for all subsequent commands.
Important Notes
- The active server setting persists across sessions. It is stored in the configuration file (
~/.jfrog/jfrog-cli.conf.v6). - Using
--server-idon a command always overrides the active server for that command only. - The
JFROG_CLI_SERVER_IDenvironment variable overrides the active server for the entire terminal session (until you close the terminal or rununset JFROG_CLI_SERVER_ID). - Concurrent sessions: All terminal sessions share the same configuration file. If multiple terminals run
jf config usesimultaneously, the last write wins and silently overrides earlier changes. For parallel or continuous integration and delivery (CI/CD) workflows, use--server-idorJFROG_CLI_SERVER_IDinstead of switching the global active server.
