Capgemini / powerapps-project-template

A Yeoman generator for scaffolding Power Apps projects based on our tooling and best practices.
MIT License
20 stars 6 forks source link

Fails to push repo to ADO when initial is not "master" #19

Closed tdashworth closed 3 years ago

tdashworth commented 3 years ago

When initialising a git repo with a default branch anything other than master (e.g. main) then the generator will fail to push the repo to ADO. Please see the below log output.

A workaround for this is to initialise the repo yourself with git init -b master or if you have already done that, create a new branch git checkout -b master then run the generator.

The fix for this would be to use the branch the init command creates or we could ask the question then use the appropriate git command to init and push.

Creating [redacted] repository...
Pushing initial commit to https://[redacted].visualstudio.com/[redacted]/_git/[redacted]
error: src refspec master does not match any
error: failed to push some refs to 'https://[redacted].visualstudio.com/[redacted]/_git/[redacted]'

Package generator encountered an error.
Rolling back all generated objects in [redacted]...
Rolling back 1 repositories...
Rolling back 0 build definitions...
Rolling back 0 releases definitions...
Rolling back 3 variable groups...
Rolling back 0 extensions...
Rolling back 0 service connections...
Error: error: src refspec master does not match any
error: failed to push some refs to 'https://[redacted].visualstudio.com/[redacted]/_git/[redacted]'

    at toError (C:\code\capgemini\powerapps-project-template\node_modules\simple-git\promise.js:90:14)
    at C:\code\capgemini\powerapps-project-template\node_modules\simple-git\promise.js:61:36
    at Git.<anonymous> (C:\code\capgemini\powerapps-project-template\node_modules\simple-git\src\git.js:937:21)
    at Function.Git.fail (C:\code\capgemini\powerapps-project-template\node_modules\simple-git\src\git.js:1475:18)
    at fail (C:\code\capgemini\powerapps-project-template\node_modules\simple-git\src\git.js:1433:20)
    at C:\code\capgemini\powerapps-project-template\node_modules\simple-git\src\git.js:1442:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
tdashworth commented 3 years ago

Fixed in #2.