3

I am getting this error when I am trying push my files into heroku rep. Ive tried following solutions but none helped:

  1. this
  2. Tried git pull heroku master (results below)
  3. Tried trying git push heroku -f (results below)
  4. set autocrlf = false

Kindly guide me through this.

Thank you

C:\myapp>git init
Reinitialized existing Git repository in C:/myapp/.git/
C:\myapp>git add .
C:\myapp>git add -u

C:\myapp>git commit -m "ic"
# On branch master
nothing to commit (working directory clean)

C:\ myapp>git push heroku
To git@heroku.com:myapp.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:myapp.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

while trying git pull heroku master

warning: no common commits
remote: Counting objects: 215, done.
remote: Compressing objects: 100% (147/147), done.
remote: Total 215 (delta 82), reused 132 (delta 62)Receiving objects:  79% (170/

Receiving objects: 100% (215/215), 1.49 MiB | 107 KiB/s, done.
Resolving deltas: 100% (82/82), done.
From heroku.com:myapp
 * branch            master     -> FETCH_HEAD
Auto-merging start.php
CONFLICT (add/add): Merge conflict in start.php
Auto-merging src/appinfo.txt
CONFLICT (add/add): Merge conflict in src/appinfo.txt
Auto-merging result.php
CONFLICT (add/add): Merge conflict in result.php
Auto-merging landhere.php
CONFLICT (add/add): Merge conflict in landhere.php
Automatic merge failed; fix conflicts and then commit the result.

while trying git push heroku -f

F:\myapp>git remote add heroku git@heroku.com:myapp.git
F:\myapp>git push heroku -f

Counting objects: 41, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (40/40), done.
Writing objects: 100% (41/41), 1.36 MiB | 12 KiB/s, done.
Total 41 (delta 0), reused 0 (delta 0)

-----> Heroku receiving push
 !     Heroku push rejected, no Cedar-supported app detected

To git@heroku.com:myapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:myapp.git'
Community
  • 1
  • 1
Maven
  • 14,587
  • 42
  • 113
  • 174
  • You say "while trying `git push heroku -f`" but the command line pasted shows no `-f`... – Kristian Glass Mar 22 '12 at 23:56
  • @Kristian Glass: sorry my bad i copied that wrong command, Ive updated my question now. – Maven Mar 23 '12 at 09:32
  • did you resolve the conflicts? – Neil Middleton Mar 23 '12 at 10:24
  • @Neil Middleton : how to resolve them, thats what i want to know. plus i wnd mind if i can just remove everything from the repo and push my new contents to it, i just want to clear the line up so i can easily push my contents. – Maven Mar 23 '12 at 10:26
  • This seems nearly identical to your previous question at http://stackoverflow.com/questions/9794413/failed-to-push-some-refs-to-githeroku-com – Dan Dascalescu Nov 13 '12 at 09:31

1 Answers1

7

It seems like you indeed have merge conflicts with the upstream. I suggest the following:

1. run git fetch origin

2. run git log ..origin/master to see what's new in the original that you still don't have. Note that 'git push -f' will override these commits if you attempt it...

3. run git pull --rebase (this might again fail with merge conflicts). After a successful pull and rebase your push should work. I would, however, pay close attention to those merge conflicts since it seems in your case they stem from a garbled history (maybe a previous merge/rebase gone awry?)

4. If all else fails, create a new branch, pointing at the origin/master (git checkout -b new_master origin/master), and then, using git-log and git-cherry-pick - fish out the only commits that are truly new in relation to origin/master. Then push this new branch and archive the old master.

Assuming the above four ways all fail, there might be a problem on the remote repository.

Hamza Ouaghad
  • 589
  • 10
  • 23
vmalloc
  • 820
  • 5
  • 8