Salesforce DX multiple computers connected to same Scratch Org

I am having a bit of trouble conceptualizing how Salesforce DX works. I just received a new computer for work and I set up the sfdx-cli and everything to get going. In my Git repo, I have all my source code, minus the config files under the .sfdx folder. Since I work at the office with one computer, and at home with another, I would like to be able to access the same scratch org from both computers.

However, when I try to connect my home computer to the same Scratch Org that my computer is connected to by sending myself the .sfdx config files, it tells me that I don’t have the correct configuration for this org. I assume the configuration is somewhere inside the apex.db file, which I can’t inspect to confirm my suspicion.

Does anybody have a clear picture of how I could connect the two computers to the same scratch org?

Answer

The easiest way would be to create a password for your scratch org user:

sfdx force:user:password:generate --targetusername <scratch_org_username_or_alias>

then on your home computer authorize into your scratch org with username and password generated in the previous step

sfdx force:auth:web:login --setdefaultusername

After that your source:push/source:pull commands with work against that scratch org

Attribution
Source : Link , Question Author : Jon Duelfer , Answer Author : steals

Leave a Comment