jacobobryant / biff

A Clojure web framework for solo developers.
https://biffweb.com
MIT License
829 stars 40 forks source link

Sometimes the first bb deploy doesn't work without -f #164

Closed jacobobryant closed 12 months ago

jacobobryant commented 1 year ago

From slack, bb deploy for a new project is giving this:

 ! [rejected]        main -> master (non-fast-forward)
error: failed to push some refs to 'ssh://[domain]/home/app/repo.git'
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.

:biff.tasks/deploy-cmd is configured correctly. For some reason, running git push prod main:master directly works, which is extremely confusing to me since that's what bb deploy is running (verified with a (prn deploy-cmd)).

Maybe this has something to do with deploying from main to master; hopefully I can reproduce it that way. At least two people have run into this already.

As a workaround, you can set :biff.tasks/deploy-cmd to ["git" "push" "prod" "main:master" "-f"]. It honestly might not hurt to just have biff include the "-f" in the default config.edn. Of course it would be nice to figure out the root cause though.

OliverM commented 1 year ago

Alternatively you can leave the deploy-cmd unmodified if you run git push prod <your branch name>:master -f in the project root - bb deploy should work fine without -f after that. I'm not sure about making -f the default, especially if you're not the only developer working on that branch (but as a solo dev it should be fine).

jacobobryant commented 1 year ago

In this case I think force pushing isn't a big deal since it's just for deploying--if you're working on a team then presumably you're also pushing the code to github or elsewhere. Either way, it'd certainly be nice to not need the workaround.

I'm actually kind of wondering if there's any point in using git to deploy at all; maybe we should just use rsync for everything... something to think about.

jacobobryant commented 12 months ago

Closed by v0.7.11 -- now bb deploy just uses rsync instead of git.