2
 [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@git.wpengine.com:production/<sitename>.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.

i am seeing this error when i try pushing the changes to the production. i did try all the possibilities suggested still i encounter this.

not sure what is causing the issue. is it related to the, legacy staging pushed to production creating an issue?

stuck on this for hours, any help would be appreciated.

catcon
  • 1,295
  • 1
  • 9
  • 18
  • 1
    What are all possibilities that you tried? Did you try the suggested solution: `git pull origin master`? – catcon Sep 03 '20 at 06:08
  • yes, i did. its says: Already up to date. But still i see the error after pushing again – Kabir Ul Althamash Sep 03 '20 at 06:12
  • 1
    That reminds me of 2015 torek's explanation to a similar issue at https://stackoverflow.com/q/33509667/6309 – VonC Sep 03 '20 at 06:15
  • 1
    please add the output of this command `git branch --all -vv | grep "origin/master"` to your question – toydarian Sep 03 '20 at 06:22
  • 1
    If you tried `git pull origin master` and still it did not work, try `git pull origin refs/heads/master` instead. There is a small chance that `master` matches another ref like `refs/for/master` which is in the front of `refs/heads/master`. And you can use `git ls-remote | grep master` to check if there is any suspicious `master` ref. – ElpieKay Sep 03 '20 at 07:40
  • @toydarian * master 05a30f8 [origin/master] interactive IR remotes/origin/HEAD -> origin/master remotes/origin/master 05a30f8 interactive IR remotes/origin/staging 4691308 commiting ^ this is the output for git branch --all -vv – Kabir Ul Althamash Sep 03 '20 at 09:06
  • Check in bitbucket, if `master` there actually points to ` 05a30f8` – toydarian Sep 03 '20 at 09:21
  • And run `git remote -v` to check if the push `origin` and the fetch `origin` are 2 different remote repos. – ElpieKay Sep 03 '20 at 09:55
  • @ElpieKay, both fetch and push origin points to the same remote – Kabir Ul Althamash Sep 03 '20 at 10:06
  • @toydarian, yes master points to '05a30f8' – Kabir Ul Althamash Sep 03 '20 at 10:06

0 Answers0