Questifer
Questifer

Reputation: 1123

Unable to push to unqualified destination: master while deploying to demo branch

I'm trying to create a demo branch for my application where suppliers can login to learn more about what it does.

I have a master branch that deploys to production on Heroku. Additionally, I have a staging branch that deploys to my Heroku staging environment. In the Github App I created a branch off of the staging branch called 'demo'.

When I deploy using CircleCI, I receive the following error:

unable to push to unqualified destination: master
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.

git push [email protected]:foobar-demo.git $CIRCLE_SHA1:master returned exit code 1

error: failed to push some refs to '[email protected]:foobar-demo.git' Action failed: git push [email protected]:foobar-demo.git $CIRCLE_SHA1:master

My circle.yml looks like the following:

deployment:
  staging:
    branch: staging
    commands:
      - heroku maintenance:on --app foobar-staging
      #- heroku scale worker=0 --app foobar-staging
      - git push [email protected]:foobar-staging.git $CIRCLE_SHA1:master
      - heroku run rake db:migrate --app foobar-staging
      #- heroku scale worker=x --app foobar-staging
      - heroku maintenance:off --app foobar-staging

  demo:
    branch: demo
    commands:
      - heroku maintenance:on --app foobar-demo
      #- heroku scale worker=0 --app foobar-demo
      - git push [email protected]:lfoobar-demo.git $CIRCLE_SHA1:master
      - heroku run rake db:migrate --app foobar-demo
      #- heroku scale worker=x --app foobar-demo
      - heroku maintenance:off --app foobar-demo

The deployment flow to staging is working fine, the only issue is with my new demo branch. I tried deleting the branch and Heroku app (foobar-demo.herokuapp.com) and haven't had any luck.

Upvotes: 1

Views: 4243

Answers (1)

Questifer
Questifer

Reputation: 1123

I found the solution in the accepted answer in this SO thread.

I had to change $CIRCLE_SHA1:master to $CIRCLE_SHA1:refs/heads/master in my circle.yml file.

Upvotes: 5

Related Questions