[git] failed to push some refs to [email protected]

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 [email protected]:myapp.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]: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 [email protected]: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 [email protected]:myapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp.git'

This question is related to git heroku git-svn

The answer is


You should check something

  1. Branch master was created in you git repository
  2. Config user.name and user.email
  3. Pull before push

I hope it will work with you


this problem arises when you have some file that is not yet added and committed to git.

git add .
git commit -m "commit done"
git push heroku master

In my case, I had an invalid package name. I wasn't able to pick up on the error code right away, because I didn't scroll up far enough, but the error was:

remote:        $ NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote: npm ERR! code EINVALIDPACKAGENAME // <-- this was hard to find
remote: npm ERR! Invalid package name "react-loader-spinne  r": name can only contain URL-friendly characters

Another issue could come from the use of backticks, those are not supported by the compiler (uglifier).

To fix it, replace config.assets.js_compressor = :uglifier with config.assets.js_compressor = Uglifier.new(harmony: true).

credits: https://medium.com/@leog7one/how-to-fix-execjs-runtimeerror-syntaxerror-unexpected-character-on-heroku-push-deployment-c0b105a64655


for me deleting package-lock.json fixed my problem,

  1. delete
  2. commit changes
  3. push again

turns out Heroku accepts only one package.json file :p


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.


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.


I had same problem, and I resolved it by doing this: heroku config:set DISABLE_COLLECTSTATIC=1 It was a django project on python 3.7


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


For me it started working after setting global username/email.

To set your global username/email configuration:
1. Open the command line.
2. Set your username:

git config --global user.name "FIRST_NAME LAST_NAME"
  1. Set your email address:
git config --global user.email "[email protected]"
  1. Commit
git commit -m "comment"
  1. Push to heroku
git push heroku master

BOOM! It worked (atleast for me)


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

On my case clearing buildpacks worked heroku buildpacks:clear


There is one more subtle reason why this might happen. If you added some new packages to your app or updated existing packages, remember to update your requirements.txt file as well.

pip freeze > requirements.txt

Then you can continue with the usual process for pushing your repository

git add .
git commit -m "Some changes"
git push heroku master

please check if you have 2 lock files if yes then leave the package-lock.json and delete the other one like yarn.lock

Then execute these commands.

  1. $ git add .
  2. $ git commit -m "yarn lock file removed"
  3. $ git push heroku master

In Heroku,you may have problems with pushing to master branch. I just had to start a new branch using

git checkout -b masterbranch

and then push using

git push heroku masterbranch

please try as above!


Also, make sure your branch is clean and there is nothing unstaged you can check with git status stash or commit the changes then run the comand


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.


I was facing this issue while deploying a django app on heroku.

In my case the requirements.txt, Procfile and runtime.txt files were present in a subdirectory. Moving them to the root directory of the repository solved the problem.

Heroku is specifically looking for requirements.txt in the root directory to setup the python environment.


P.S :

If heroku is unable to reach till the wsgi file residing in the subdirectory, solve it by referring below thread -

How can I modify Procfile to run Gunicorn process in a non-standard folder on Heroku?


It is probably due to an Outdated yarn.lock file

Just run the following commands

yarn install
git add yarn.lock
git commit -m "Updated Yarn lockfile"
git push heroku master

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

I had similar issue where local build was working fine however when I push my branch onto heroku it would fail to build. Issue was that I had some devDependencies in my package.json which were not installed during npm install which was causing my build to fail.

If you need access to packages declared under devDependencies in a different buildpack or at runtime, then you can set NPM_CONFIG_PRODUCTION=false or YARN_PRODUCTION=false to skip the pruning step.

Also you can move you devDependencies into dependencies...


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


If your heroku project root is in a different directory than your git branch root, use this:

git subtree push --prefix path/to/root heroku master


When I tried git pull heroku master, I got an error fatal: refusing to merge unrelated histories.

So I tried git pull heroku master --allow-unrelated-histories and it worked for me


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


Just switch the branch to main, It will surely work, and delete the project from Heroku remote. Delete all branches from local and use only one "main".

For reference: https://help.heroku.com/O0EXQZTA/how-do-i-switch-branches-from-master-to-main


I had the same problem, the solution was

in my branch, called "testBranchSuper"

i use

git checkout -b main

and then i use

git push heroku main


For me force with push operation worked.

git push heroku master --force

Case - when pushed commit from current branch was removed(commit was pushed to remote repository).


Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to heroku

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip Can't push to the heroku ImproperlyConfigured: You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings How to enable CORS in flask Error: Cannot pull with rebase: You have unstaged changes How to solve error "Missing `secret_key_base` for 'production' environment" (Rails 4.1) Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin ('null') 'heroku' does not appear to be a git repository Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes How do I set up DNS for an apex domain (no www) pointing to a Heroku app?

Examples related to git-svn

How can I remove an SSH key? How can I combine two commits into one commit? failed to push some refs to [email protected] How to remove origin from git repository See changes to a specific file using git No newline at end of file Checkout remote branch using git svn How to git-svn clone the last n revisions from a Subversion repository? Pushing an existing Git repository to SVN How do I migrate an SVN repository with history to a new Git repository?