Push to Dokku rejected in CI deploy

I have the following .gitlab-ci.yml config stage:

  stage: deploy
    - git push dokku@mydokku.com:phoenix master

But it’s failing because master is supposedly behind…I guess the Gitlab CI runner could be doing a shallow clone or something that would prevent another remote from seeing it as a correct repository.

$ git push dokku@mydokku.com:phoenix master
Warning: Permanently added the ECDSA host key for IP address '' to the list of known hosts.

To dokku@mydokku.com:phoenix
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'dokku@mydokku.com:phoenix'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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.
ERROR: Build failed: exit code 1

Verbose output from Dokku available here: https://gist.github.com/ashleyconnor/15e05edce7824ed326a91e1c10ed4b4d

Ah ok this turned out to be an easy one.

In the CI/CD settings for a project switch from git fetch to git clone - you will then be able to push to alternative remotes.

1 Like