Salesforce DX – how to set default devhub if I missed the -d option when connecting to devhub

If I missed the -d option when using sfdx force:auth:web:login, is there a way to reset it as default devhub afterwards? I searched through the document but didn’t see any.

Answer

You can use sfdx force:config:set defaultdevhubusername=me@myhub.org.
You can use the additional -g parameter if you want to set it globally.

The related doc is here, in addition to using sfdx force:config:set -h.

You can also set afterwards your default Scratch Org using sfdx force:config:set defaultusername=me@my.org.

Attribution
Source : Link , Question Author : Lance Shi , Answer Author : Fabien Taillon

Leave a Comment