---
schema_version: "1"
id: 82a2960e3dbf334a7ee9489e98f4dcb8c3a3bb0e5c1696cfe176e9099b3390cc
title: config set
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/config/cli_reference_config_set.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_config_set.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 42bab8b7780d4361c09d29228833f6cbca248175f47e2b99a64f06c08032dddc
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# config set

Set one or more configuration variables, such as your default org.

## Description for config set

Use configuration variables to set CLI defaults, such as your default org or the API version you want the CLI to use. For example, if you set the "target-org" configuration variable, you don't need to specify it as a "sf deploy metadata" flag if you're deploying to your default org.

Local configuration variables apply only to your current project. Global variables, specified with the --global flag, apply in any Salesforce DX project.

The resolution order if you've set a flag value in multiple ways is as follows:

1. Flag value specified at the command line.

2. Local (project-level) configuration variable.

3. Global configuration variable.

Run "sf config list" to see the configuration variables you've already set and their level (local or global).

If you're setting a single config variable, you don't need to use an equal sign between the variable and value. But you must use the equal sign if setting multiple config variables.

For the full list of available configuration variables, see https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_config_values.htm.

## Aliases for config set

`force:config:set`

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;global</code> | <code>&#8209;g</code> | **Type:** Boolean<br><br>Set the configuration variables globally, so they can be used from any Salesforce DX project. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |

## Examples for config set

Set the local target-org configuration variable to an org username:

```shell
sf config set target-org me@my.org
```

Set the local target-org configuration variable to an alias:

```shell
sf config set target-org my-scratch-org
```

Set the global target-org and target-dev-hub configuration variables using aliases:

```shell
sf config set --global target-org=my-scratch-org target-dev-hub=my-dev-hub
```
<!-- prettier-ignore-end -->
