I'm doing one of the Salesforce DX trailheads and am running into an issue where the error message is, "The scratch org does not belong to the dev hub username" when creating a password for a scratch org. Any tips?
Did you login into your DevHub instance before trying to generate password with this command?
sfdx force:auth:web:login -d -a DevHub
If you did not specify the -d flag, or you did use the -d flag on a different org during creating it, you wont be able to create scratch orgs until you correctly identify the Dev Hub using the config:set command, for example:
force:config:set email@example.com firstname.lastname@example.org
If everything is ok and there is a (D) next to your DevHub org when you run
you should be able to execute these commands
sfdx force:org:create -f config/project-scratch-def.json -a YourScratch sfdx force:user:password:generate -u YourScratch sfdx force:org:display -u YourScratch
and should see the new password in the detail. Hope this helps.