5

When I attempt the git push heroku master command I get the following error:

matt@matt-desktop:~/Documents/Ruby/rails_projects/ninja_speak_app$ git push heroku master
To https://git.heroku.com/limitless-inlet-4477.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://git.heroku.com/limitless-inlet-4477.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.

This repository was set up yesterday on github and is called ninja_speak_app. While setting up the repository I was careful not to initialize with a readme file or license.

When I do a git pull I get the following:

matt@matt-desktop:~/Documents/Ruby/rails_projects/ninja_speak_app$ git pull
Already up-to-date.

Commit also shows everything is up to date:

matt@matt-desktop:~/Documents/Ruby/rails_projects/ninja_speak_app$ git commit -m "first commit"
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean

Edit: running git push --force heroku master yields the following:

matt@matt-desktop:~/Documents/Ruby/rails_projects/ninja_speak_app$ git push --force heroku master
Counting objects: 25701, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (25297/25297), done.
Writing objects: 100% (25701/25701), 104.98 MiB | 97.00 KiB/s, done.
Total 25701 (delta 322), reused 25668 (delta 309)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: Build stream timed out, reverting to polling....
remote: !   Timeout reached polling for results.
remote: 
To https://git.heroku.com/limitless-inlet-4477.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/limitless-inlet-4477.git'

I'm able to get code up to heroku using --force but any thoughts on why it still errors out?

Edit2:

Running git pull heroku master yields:

matt@matt-desktop:~/Documents/Ruby/rails_projects/ninja_speak_app$ git pull heroku master
warning: no common commits
remote: Counting objects: 69191, done.
remote: Compressing objects: 100% (45212/45212), done.
remote: Total 69191 (delta 17653), reused 68275 (delta 16751)
Receiving objects: 100% (69191/69191), 129.00 MiB | 884.00 KiB/s, done.
Resolving deltas: 100% (17653/17653), done.
From https://git.heroku.com/limitless-inlet-4477
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> heroku/master
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 673, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (594/594), done.
Writing objects: 100% (673/673), done.
Total 673 (delta 239), reused 0 (delta 0)
error: The following untracked working tree files would be overwritten by merge:
    db/development.sqlite3
    db/production.sqlite3
    db/test.sqlite3
    log/development.log
    log/production.log
    log/test.log
    tmp/cache/assets/C12/AE0/sprockets%2Fc558458ba9671201141a50f2240184c9
    ...
    ...
Aborting

Git push heroku master then yields:

matt@matt-desktop:~/Documents/Ruby/rails_projects/ninja_speak_app$ git push heroku master
To https://git.heroku.com/limitless-inlet-4477.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/limitless-inlet-4477.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
1
  • your git pull aborted. Either commit your work prior to pulling or throw it away or stash it Commented Feb 19, 2015 at 4:16

5 Answers 5

5

If you are sure of what you're doing you can force the push to heroku:

git push --force heroku master
Sign up to request clarification or add additional context in comments.

2 Comments

any way to do this without the --force parameter?
IMO, you have rollbacked a commit localy, then you pushed to github so your heroku repo and your local/github repos are out of sync. To fix this force push on heroku
5
+50

That means you have code in your repository newer than the code in your local repository. You have to merge your changes locally :

git pull heroku master

then you push :

git push heroku master

EDIT (following your edit) :

try git fetch origin

git pull --rebase

push again

1 Comment

edited question with messages that resulted from trying above. Any thoughts?
1

Here is what ended up working for me:

I logged into my heroku account and went to the 'Deploy' tab. From here there is a 'Connect to GitHub' option which will allow you to manually link the two accounts. After the accounts are linked you can search for the GitHub repo on the heroku account. Once linked, I chose the 'manual deploy' option. Since this manual deploy I've been able to use git push heroku master without issue.

1 Comment

I'm going to test this one out as rolling back to a previous version did not work
0

You need to run

git pull heroku_app_name master

Hope it works.

3 Comments

matt@matt-desktop:~/Documents/Ruby/rails_projects/ninja_speak_app$ git pull limitless-inlet-4477 master fatal: 'limitless-inlet-4477' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
You need to do: git remote add heroku [email protected]:project.git where git url is found in your heroku app settings page. Hope it works now.
ran this command: git remote add heroku [email protected]:limitless-inlet-4477.git but still get same error described in question (i.e. 'failed to push some refs') when run git push heroku master
0

If you have used - bundle install --without production and did not do - git commit -am "installed using bundle"

then you are more likely to face such an issue.

If you have already run -bundle install--without production then follow the following steps and you can resolve the problem:

  1. Open your Gemfile and put your Ruby version in it:
    • ruby '2.2.1'
  2. $ git commit -am "updated the Gemfile"
  3. $ git push heroku master

This resolved the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.