My situation now is that I went ahead and did some changes I shouldn't have done to my sfdx config and now both my default username and my devhubusername are set to my production user, and both are global values. So when I open up the scratch org, it launches the production Salesforce instead of a scratch org, which is what I want. how do I unset this? My config right now when issuing sfdx force:config:list --json is

"key": "defaultdevhubusername",
  "location": "Global",
  "value": "*production user name*"
  "key": "defaultusername",
  "location": "Global",
  "value": "*production user name*"

Obviously not an ideal situation.


Use the config commands:

sfdx force:config:set defaultusername=me@my.org defaultdevhubusername=me@myhub.org -g

With the -g you set your globals. Setting them "blank" clears the (global) setting (thanks for the reminder Rahul!).

| improve this answer | |

In addition to the answer by @Phil W. If you want to remove the global value of defaultdevhubusername. you can reset it using the below command.

sfdx force:config:set defaultdevhubusername= -g

It will clear the value.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.