无法推送到不合格的目的地:部署到演示分支时掌握

Que*_*fer 1 git heroku circleci

我正在尝试为我的应用程序创建一个演示分支,供应商可以在其中登录以了解有关其功能的更多信息。

我有一个主分支,可以在 Heroku 上部署到生产环境。此外,我有一个部署到我的 Heroku 暂存环境的暂存分支。在 Github 应用程序中,我从暂存分支创建了一个名为“演示”的分支。

当我使用 CircleCI 进行部署时,我收到以下错误:

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 git@heroku.com:foobar-demo.git $CIRCLE_SHA1:master returned exit code 1

error: failed to push some refs to 'git@heroku.com:foobar-demo.git' Action failed: git push git@heroku.com:foobar-demo.git $CIRCLE_SHA1:master
Run Code Online (Sandbox Code Playgroud)

我的 circle.yml 如下所示:

deployment:
  staging:
    branch: staging
    commands:
      - heroku maintenance:on --app foobar-staging
      #- heroku scale worker=0 --app foobar-staging
      - git push git@heroku.com: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 git@heroku.com: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
Run Code Online (Sandbox Code Playgroud)

暂存的部署流程工作正常,唯一的问题是我的新演示分支。我尝试删除分支和 Heroku 应用程序(foobar-demo.herokuapp.com),但没有任何运气。

Que*_*fer 5

我在这个SO thread 中接受的答案中找到了解决方案。

我不得不在我的 circle.yml 文件中更改$CIRCLE_SHA1:master$CIRCLE_SHA1:refs/heads/master