Unable to Push deployment from Github repository to CloudClontrol using Travis CI, Below is the log:
Deploying application
Warning: Permanently added 'cloudcontrolled.com' (RSA) to the list of known hosts.
To ssh://xxx.git
! [rejected] HEAD -> master (fetch first)
error: failed to push some refs to 'ssh://awesomeblog#cloudcontrolled.com/repository.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
Is there a way to force hard push overriding the status of remote git?
In case you need to see full logs, you can find it here https://s3.amazonaws.com/archive.travis-ci.org/jobs/26330194/log.txt. Note that the relevant log is at the end.
I was able to get this problem solved with new feature released by Travis CI,
they have added -f option while doing a push during deploy.
All you need to do is add
edge: true
option for Cloudcontrol deployment as described here http://docs.travis-ci.com/user/deployment/#Other-Providers , in your yml file
Related
Frequently (especially with commits using --amend) I push to heroku using git push heroku master --force. I do this because I get an issue when trying to push without force..
issue:
o https://git.heroku.com/site.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/site.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.
I see no harm in it because my remote repository and local repository are fine. Am I wrong?
This warning happens because the commits are different and thus your repository cannot ensure data preservation, it is bad practice since it could lead to code data loss, as long as you know it won't, Heroku itself will not have a problem as all it does is take the code in the master branch and deploy it, regardless of previous states.
I have been trying to push my app to heroku using git push heroku master
but I keep getting this error message. what should I do?
error: failed to push some refs to 'https://git.heroku.com/raad-photo-app.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.
Related Image
You must pull latest changes from the remote before you can push.
Someone added new code which you don't have locally do you must grab it first.
Read this question to understand what is pull and why do you need it.
Local branch behind remote branch (pull, rebase, fetch, merge)
I have started learning Ruby on Rails and Git.
Whenever I try to push any changes to my remote repo on Github, I encounter the following error:
C:\Sites\first>git push origin master
To git#github.com:piy9/Twitter_clone.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:piy9/Twitter_clone.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
NOte: I have added all the files in the directory and committed the changes. I have not created any separate branches using pull or checkout.
I am not asking for a solution to the problem.
doing
git push -f or
git push origin +HEAD
worked for me.
What I want to know is, why am I getting the error while trying to push to the original branch.
follow this and get everything works....
git branch production
git checkout production
#do some code changes
git commit -am "some desparate code changes to try fix heroku"
git push heroku production:master
Note: this will get your work done and will leave your previous branch.
or you can try this one also git push heroku +master
Looks like remote branch is ahead of yours, which means it contains something your local branch does not have. You may easily see commits on remote branch since when local branch was created or updated (assuming you run "git fetch origin/master" to fetch remote changes first):
git diff HEAD...origin/master
The output will answer your question why you are getting the error.
Now, my guess about the reason of the problem you have is that either someone has access to remote and pushed something, or you modified something using github editing interface and committed since last checkout/pull/merge. Using forced push as you did is not a good approach and it messes the history, it basically overwrites the remote branch with your copy, ignoring any remote changes.
I got this error message (copied below) after trying to push to Heroku. I initially set up a facebook canvas app and selected the hosting on heroku options. It gave me a heroku url, which I added as a remote on the app I was developing on my machine
heroku git:remote -a desolate-springs-1684
But when I pushed, I got this error
error: failed to push some refs to 'git#heroku.com:desolate-springs-1684.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.
localhost:nhl michaelmitchell$
So I did
git push -f heroku master
But now I apparently have to do a 'git pull'. However, what do i put after the 'git pull'? The name of the heroku url? or something else?
Forcing your git push was not a good idea because you lost any commit that was done by you or other collaborators you were missing on your working copy.
Before pushing, you should have either merged or rebased the upstream changes into your local working copy.
To merge the changes locally
$ git pull heroku master
$ git push heroku master
To rebase the changes locally
$ git pull --rebase heroku master
$ git push heroku master
BTW, now that you have pushed your changes, you actually don't need to do anything else. The remote repository already contains all your changes.
If for whatever reason the $ git status command is returning outdated references, simply run
$ git pull heroku
to fetch all the remote changes. Please note that unless you specify a target branch (or you have the tracking branch enabled), git pull will simply download (and not merge) the upstream changes.
Also note that Heroku should not be considered a git hosting. It means that it's extremely uncommon to perform a git pull from Heroku. Instead, you should use a git hosting (such as GitHub or BitBucket) to store your repository and only perform push to Heroku to deploy the application.
That error basically means that there is code in the repo that is newer than the code you're trying to push to it.
you have to do a pull and update your own working repository then push again, or just force a push
git pull heroku master
As a side note, if you aren't familiar with all the git commands, I would recommend you use a GUI as it may make the whole process a lot less overwhelming.
There are plenty of great clients here: http://git-scm.com/downloads/guis
I'm using Heroku and have a Rails app that is stable (production env), so I wanted to create something new where I can have quality assurance env where I can see how the changes will work on Heroku (as well as aggregating enhancements for releases) without always pushing to my production app.
So what I did was create a new Heroku app, and also create a new branch locally (dev). My intention was to merge dev into master locally after I tested the change on my new Heroku QA app, and then push to Heroku production from my master branch.
My approach might be a bad one with my landscape, I'm a newbie, so this was just my best guess at how to do this.
But when I pushed my dev branch to my new QA app, it worked for pushing to a dev branch of the QA app, but not the master. So I couldn't see (and test) my changes on the new QA app. It seems to be telling me that I can only push the master branch to the master of my QA app, since I pulled already and everything was already up-to-date, but I receive this error:
Pushing to git#github.com:foobar/QA.git
To git#github.com:foobar/QA.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:foobar/QA.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Can someone please help me figure out what I'm doing wrong - either with my environments or with Git? Thank you.
Try pushing with the -ff (fast-forward) option: git push heroku master -ff (replace heroku with the actual name of heroku remote).
Heroku apps only run off of the master branch of the app repository (local to Heroku). If you want to deploy a branch to Heroku which isn't the master branch of your local repo, then you need to specify it. In your case it would be something like git push qa-remote dev:master (replace qa-remote with the actual name of the remote to your QA app), which says push my local dev branch to the master branch on qa-remote.
When you push like that for the first time, you'll likely need to add the -f flag to force push (non-fast-forward). Subsequently you should be able to push without the -f flag, as long as your local branch is up-to-date.
Use the following command to push the update forcefully git push -f heroku master