[SalesForce] Don’t see option “SFDX: Push Source to Default Scratch Org” in the command palette in VS Code

I have an sfdx project opened in VS Code as workspace folder. I don't see the option for "SFDX: Push Source to Default Scratch Org" in the command palette. Other commands like "SFDX: Refresh SObject Definitions" are visible and I can execute them just fine.

enter image description here

This question No Option for “SFDX:Authorize an Org” command in VS Code Command Palette does not help, since I have an sfdx project already.

Edit

In my case I am logged in a scratch org with a namespace.If I run the command sfdx force:org:push in the command line, it gets executed just fine. And sometimes when I reopen VS Code with the same workspace folders, I can see "SFDX: Push Source to Default Scratch Org" in the command palette.

Best Answer

Try clicking on your scratch org name( you have greyed it out) in the bottom bar and then selecting it as default. Or you can run sfdx force:config:set defaultusername=Org_Alias command from CLI or any script you are using. I face this issue everytime i create a new scratch org(4-5 times per day) and I always have to do this step. I believe it's an issue with VS code/SF cli which is unable to recognize the org as default.