I have been trying to achieve this goal for weeks. The closest I can get is using the following steps:
sfdx force:project:create -n myproject cd myproject mkdir temp sfdx force:mdapi:retrieve -s -r ./temp -u production -k ../package.xml unzip ./temp/unpackaged.zip -d ./temp/ sfdx force:mdapi:convert -r ./temp
As a final step I tried running both source push
sfdx force:source:push -u scratchorg
And source deploy
sfdx force:mdapi:deploy -g -o -u scratchorg -d .
I keep getting thousands of errors , some of the errors :
Invalid fullName, must end in a custom suffix ( for ex. __c )
Can't specify an external sharing model for Opportunity
Must specify a non-empty label for the CustomObject
Could not resolve standard field's name. (136:13)
And many more error.
Is there any way to successfully copy production org into a scratch org ?