Github pages force push

I’m having issues pushing a github pages build.

Here’s my yaml configuration.

kind: pipeline
name: default

steps:
- name: build
  image: cbrgm/drone-hugo:latest
  settings:
    hugo_version: 0.81
    validate: true
    url: https://www.esamir.com
- name: publish
  image: plugins/gh-pages
  settings:
    pages_directory: public
    upstream_name: https://github.com/safaci2000/safaci2000.github.io.git
    target_branch: master
    force_push: true
    username:
      from_secret: gh_username
    password:
      from_secret: gh_password

I generated a personal access token as detailed here which I’m using for the value for password passed in via gh_password.

When the build runs, I get this error:

+ git push https://github.com/******/******.github.io.git HEAD:master
To https://github.com/******/******.github.io.git
 ! [rejected]        HEAD -> master (fetch first)
error: failed to push some refs to 'https://github.com/******/******.github.io.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
2021/02/25 09:41:51 failed to push changes: exit status 1

You can see the full output of the build here. Any thoughts what I’m doing wrong. I think the force_push: true isn’t supported but I haven’t found any equivalent.

Based on what i’m reading i’m leaning towards it not being supported for that particular plugin. Did I miss something?

There is no such setting as force_push which is why it does not work. However, there is a force setting which is documented along with the other settings at plugins.drone.io/appleboy/drone-git-push/.

If you have any questions about this plugin, you may also consider evaluating the source code, and / or contacting the plugin author via their github repository:

sorry, I thought you were using the git push plugin and sent you the wrong link. you are correct that the gh-pages plugin does not have a force option. You can see the plugin source here, and can submit a patch if you would like the field added:

I took a pass at submitting a PR, I don’t fully understand the plugin architecture but I think that should work.