Task: 我想使用Bitbucket管道将Jekyll站点部署到Heroku而不添加由本地Jekyll构建生成的 _site 文件夹 .

Possible Solution: 下面是我在Docker容器中构建Jekyll _site 文件夹的管道命令,修改了git索引,然后推送到Heroku . 构建传递并正确部署到Heroku .

script:
  - bundle install --path vendor/bundle
  - npm install -g gulp
  - gulp preview
  - git config --global user.email $EMAIL
  - git config --global user.name $USER
  - git rm . -r --cached
  - git add -f Procfile index.js _site package.json
  - git commit -m "Eliminate all but site"
  - git push -f https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD

Remaining Concerns: 我'm removing all of the files from the index except for the files that Heroku needs to deploy. I'也强迫 git addgit push ,这通常是不鼓励的(12) . Fyi, git push --force-with-lease 失败w / ! [rejected] HEAD -> master (stale info)

我发现了对Bitbucket管道和Heroku的 git --force 命令的上述用法的任何引用 . 但由于Bitbucket管道命令是在Docker container with a cloned repo内执行的,因此特殊用法不应该't matter, right? It'更改bc这些更改完全独立于本地副本和Bitbucket repo . 关于覆盖当地变化和历史的常见问题不适用 .

我只与Bitbucket管道,Jekyll和Docker合作了几个星期,所以我只是想确保我覆盖我的基地 . 谢谢你的帮助!