Manage Server Configurations
Add, view, activate, export, and remove JFrog CLI server configurations in this step-by-step tutorial.
This procedure walks you through adding, viewing, activating, exporting, and removing JFrog CLI server configurations from the command line.
Prerequisites
- JFrog CLI installed (installation guide)
- A JFrog Platform URL (for example,
https://mycompany.jfrog.io) - A JFrog access token. Generate one from Administration, then Identity and Access, then Access Tokens in the JFrog Platform UI
Set both as environment variables before continuing. The following steps pass them into jf config add as --url and --access-token (for example --url=$JFROG_URL). The CLI does not read JFROG_URL or JFROG_ACCESS_TOKEN automatically unless you expand them into flags or other supported inputs. If either value is empty when passed, jf config add still exits 0 and does save an incomplete configuration under that server ID. It does not skip the save. An incomplete configuration (missing URL and/or credentials) cannot be used for any operations, so always verify with jf config show <server-id> immediately after adding.
export JFROG_URL="https://<your-instance>.jfrog.io"
export JFROG_ACCESS_TOKEN="<your-access-token>"Verify they are set before proceeding:
echo "URL : $JFROG_URL"
echo "TOKEN set: $([ -n "$JFROG_ACCESS_TOKEN" ] && echo yes || echo NO — set it before continuing)"This topic covers the following tasks:
- Step 1: Add a server
- Step 2: Show all configurations
- Step 3: Show a specific server
- Step 4: Set as active server
- Step 5: Export configuration
- Step 6: Remove the server
Step 1: Add a Server
Add a server in non-interactive mode so you can script this step. Use --overwrite to replace an existing configuration with the same ID.
To add a server configuration:
-
Run the following command:
jf config add <server-id> --url=$JFROG_URL --access-token=$JFROG_ACCESS_TOKEN --interactive=false --overwrite
Replace <server-id> with a name you choose (for example, tutorial-server). The command stores your credentials in the configuration directory.
Expected output
The command produces no output on success. A silent exit 0 means a configuration was saved under that server ID — but it does not guarantee the configuration is complete. If
$JFROG_URLor$JFROG_ACCESS_TOKENare empty, the command still exits 0 silently and still saves an entry under<server-id>, just missing the URL and/or credentials. Always verify immediately after with the following command.
jf config show <server-id>You should see output like the following:
Server ID: tutorial-server
JFrog Platform URL: https://<your-instance>.jfrog.io/
Artifactory URL: https://<your-instance>.jfrog.io/artifactory/
Distribution URL: https://<your-instance>.jfrog.io/distribution/
Xray URL: https://<your-instance>.jfrog.io/xray/
Mission Control URL: https://<your-instance>.jfrog.io/mc/
Default: trueThe JFrog CLI derives the Artifactory, Distribution, Xray, and Mission Control URLs from the platform URL automatically. Only fields that were actually set are printed, so an incomplete configuration (for example one added with an empty --url) shows just Server ID and Default.
If this is your first or only server, Default: true is shown automatically. If you already have other servers configured, the new server is added with Default: false until you run jf config use (see Step 4).
If you see [Error] Server ID '<server-id>' does not exist, go back and confirm $JFROG_URL and $JFROG_ACCESS_TOKEN are set correctly, then re-run the jf config add command.
Step 2: Show All Configurations
View every server configuration you've added so far.
To view all configured servers:
-
Run the following command:
jf config show
Expected output (1 block per configured server):
Server ID: tutorial-server
JFrog Platform URL: https://<your-instance>.jfrog.io/
Artifactory URL: https://<your-instance>.jfrog.io/artifactory/
Distribution URL: https://<your-instance>.jfrog.io/distribution/
Xray URL: https://<your-instance>.jfrog.io/xray/
Mission Control URL: https://<your-instance>.jfrog.io/mc/
Default: trueIf the command returns no output, no servers have been added yet. Run jf config add first.
Step 3: Show a Specific Server
Focus on 1 server when you have multiple configurations.
To view details for a specific server:
-
Run the following command:
jf config show <server-id>
Expected output:
Server ID: tutorial-server
JFrog Platform URL: https://<your-instance>.jfrog.io/
Artifactory URL: https://<your-instance>.jfrog.io/artifactory/
Distribution URL: https://<your-instance>.jfrog.io/distribution/
Xray URL: https://<your-instance>.jfrog.io/xray/
Mission Control URL: https://<your-instance>.jfrog.io/mc/
Default: falseIf you see [Error] Server ID '<server-id>' does not exist, the server was not added. Repeat Step 1.
Step 4: Set as Active Server
Make this server the default target for future commands.
To set a server as the active default:
-
Run the following command:
jf config use <server-id>
On success the command prints a line such as [Info] Using server ID 'tutorial-server' (https://<your-instance>.jfrog.io/). To confirm, run jf config show and verify Default: true for that server. If <server-id> does not exist, the command prints [Error] Could not find a server with ID '<server-id>'. and exits non-zero, leaving the active server unchanged.
Step 5: Export Configuration
Export a portable token so you can restore this configuration on another machine.
To export a configuration token for use on another machine:
-
Run the following command:
jf config export <server-id>
Expected output is a single base64-encoded token:
eyJ2ZXJzaW9uIjoiMSIsInVybCI6Imh0dHBzOi8v... (truncated)Copy this token and run jf config import <token> on the target machine to restore the server configuration. For more information, see Importing a Server Configuration.
Step 6: Remove the Server
Remove the configuration when you're done with the tutorial or the server is no longer needed.
To remove a server configuration:
-
Run the following command when you are done:
jf config remove <server-id> --quiet
The --quiet flag skips the interactive confirmation prompt. The command produces no output on success (exit 0). If the server ID does not exist, the command still exits 0 and prints an informational message. This is intentional idempotent behavior, safe for use in continuous integration and delivery (CI/CD) cleanup scripts. jf config remove and its alias jf config rm are equivalent.
Summary
You have added a server, viewed its configuration, set it as active, exported it, and removed it. You can repeat this flow for multiple servers. For CI/CD, use --interactive=false and environment variables for --url and --access-token.
Common Issues and Fixes
The following table lists common problems and how to resolve them.
| Problem | Fix |
|---|---|
jf config add exits 0 silently but jf config show <server-id> shows an incomplete entry (missing URL or credentials) | $JFROG_URL or $JFROG_ACCESS_TOKEN was empty when you ran the command. The server ID was still saved, just without a usable URL/credentials. Re-run jf config add <server-id> --overwrite with both environment variables set. |
| "Server ID already exists" | Add --overwrite to jf config add |
jf config show returns no output | No servers have been added yet. Run jf config add first |
Config token from jf config export doesn't import | The access token in the configuration may have expired. Re-add with a fresh token |
| Wrong server is used for commands | Run jf config use <correct-server-id> to switch the active server |
Tips for CI/CD
- Always use
--interactive=falsein pipelines. Interactive prompts hang CI runners. - Use environment variables (
JFROG_URL,JFROG_ACCESS_TOKEN) as the source of truth. Pass them tojf config add. - Add cleanup steps:
jf config remove <server-id> --quietto avoid credential leakage (rmis a short alias forremove). - Set
CI=trueto ensure all commands default to non-interactive behavior.
Frequently Asked Questions
This section provides answers to frequently asked questions.
FAQs
Q: How do I add a JFrog CLI server configuration from the command line?
A: Run jf config add <server-id> --url=$JFROG_URL --access-token=$JFROG_ACCESS_TOKEN --interactive=false --overwrite. See Step 1: Add a Server for the full walkthrough.
Q: What happens if JFROG_URL or JFROG_ACCESS_TOKEN is empty when I run jf config add?
A: The command still exits 0 and saves a configuration under that server ID, but it's incomplete and can't be used for any operations. Always verify with jf config show <server-id> immediately after adding.
Q: How do I export a server configuration to use it on another machine?
A: Run jf config export <server-id> to get a base64-encoded token, then run jf config import <token> on the target machine. See Step 5: Export Configuration.
Q: What's the difference between jf config remove and jf config rm?
A: They're equivalent. rm is a short alias for remove, and both remove a server configuration.
Q: Is it safe to run jf config remove on a server ID that doesn't exist?
A: Yes. The command still exits 0 and prints an informational message, which makes it safe to use in CI/CD cleanup scripts. See Step 6: Remove the Server.
Related Topics
Updated 2 days ago
What’s Next
For advanced customization, review the environment variables reference.
