0

One of my commit messages got corrupted somehow, and now git push doesn't work. The error message (shown below) isn't helping me figure out how to fix the problem.

$ git push -f

37:42: syntax error: Expected end of line but found identifier. (-2741)

error: failed to push some refs to [myrepo]

I don't want to overwrite my local version because the code on my local machine is more up-to-date than what is on the repo. How can I restore my workflow of pushing my most up-to-date code from my machine to the repo?

musiKk
  • 14,193
  • 4
  • 53
  • 81
  • 1
    That message is not coming from `git push`, nor indeed any part of git itself. Do you have a pre-push hook, or does the other end have a pre-receive or update hook, that might cause this? (Lack of `remote:` in front of the error message suggests it's your own pre-push hook.) – torek Mar 18 '15 at 08:30
  • Googling for the error message indicates that it comes from AppleScript. If so, this might be unrelated to git. – musiKk Mar 18 '15 at 09:32
  • I don't know if I have a pre-push hook. How do I find out? How do I interact with AppleScript? – sealauren Mar 27 '15 at 19:52

1 Answers1

-1

This is an often reoccuring problem:

git push github master
To git@github.com:Joey-project/project.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Joey-project/project.git'

In general one has to use a variation of the following commands:

git fetch github; git merge github/master

I'm not completely sure if it covers everything, but it could be useful to also look at: Git non-fast-forward updates were rejected Merge the remote changes .

Community
  • 1
  • 1
Joey Dorrani
  • 371
  • 1
  • 1
  • This clearly isn't problem with non-fast-forward push. At this time using merge won't help, and may affect git history in an undesirable way. – Frax Mar 18 '15 at 10:03