failed to push some refs to git@heroku.com

匿名 (未验证) 提交于 2019-12-03 01:47:02

问题:

I am getting this error when I am trying push my files into heroku rep.

Ive set autocrlf = false already in gitconfig but this problem is still there. i have also tried this solution here but no gain.

Any suggestion is this possible that git is still using old config setting if yes then how can I refresh it.

Thankyou

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  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' 

回答1:

This error means that the upstream repository has made commits that would be lost if you were to push. First do a "git pull" to merge, and then push again.



回答2:

Execute this:

$ rake assets:precompile $ git add . $ git commit -m "Add precompiled assets for Heroku" $ git push heroku master 

Source: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book



回答3:

I'm the only person working on my app and only work on it from my desktop, so the possibility that I managed to get the heroku repository above dev didn't make sense. BUT! I recently had a Heroku support rep look into my heroku account for a cache issue involving gem installs and he had changed something that caused heroku to return the same error as the one listed above. A git pull heroku master was all it took. Then I found the reps minor change and reverted it myself.



回答4:

If you want to push commit on git repository, plz make sure you have merged all commit from other branches.

After merging if you are unable to push commit, Use the push command with -f

git push -f origin branch-name

Where origin is the name of your remote repo.



回答5:

Make sure you’re pushing the right branch. I wasn’t on master and kept wondering why it was complaining :P



回答6:

For anyone arriving here from a Google search with the same error message. Also be aware that you can have a problem if you are using sqlite3

https://devcenter.heroku.com/articles/sqlite3



回答7:

It would appear that you are not fully up-to-date. You would need to do a git pull and either "--rebase" or let it merge into your set.

After this, you should then be able to push, since it would be a 'fast-forward' change that wouldn't remove history.

Edit: example command list

git pull git push 


回答8:

I was getting this error because I added a line to my requirements.txt file that had an error:

simplejson=2.6.2 

There was only one = and there should be two:

simplejson==2.6.2 

Correcting this fixed the error.



回答9:

The simple solution is to make sure you have a file named "Gemfile" with a capital "G" in your app folder! :) It totally sucks this isn't in the docs but the whole morning trying to figure it out.



回答10:

I followed the following steps and it worked for me.

  • Please take a copy of your (local) changes. fetch heroku reset --hard heroku/master Then try to 'git push heroku'.


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!