[SalesForce] How to open a scratch org created in another machine

I have created a scratch org on my home machine and it is active and can be seen in the devhub. And I am now on my office computer.

However, when I use sfdx force:org:list I can't see that particular scratch org. And if I directly use sfdx force:org:open -u [userName] it comes back with an error message. And I am not quite sure what the password is for that particular scratch org.

What should I do in this case?

Best Answer

sfdx force:org:list

The above command is specific to the machine you used. So don't think your office laptop has any knowledge of what orgs you authenticated with and set as the default hub org and the default scratch org.

You will need to authorize all the orgs you have with your office laptop again, and create your scratch org again from the office CLI.

Follow the below steps

1.Again authorize your scratch org using the sfdx force:auth:web:login and entering the username and password

2.Use force:config:set to set the default scratch org

sfdx force:config:set defaultusername=test-wvkpnfm5z113@example.com

Optioanlly you can use sfdx force:alias:set to set alias as well default scratch org and the hub org .