I am not able to push to staging for heroku.
When I am doing git remote staging master I am getting
fatal: 'staging' does not appear to be a git repository
fatal: Could not read from remote repository.
Although I used to push to staging using the same command.
git remote -v
returns
origin git#bitbucket.abc/test.git (fetch)
origin git#bitbucket.org:abc/test.git (push)
I tried to add a git remote, but It created something else and when I did git push staging master, It created another url of the app instead of pushing for the earlier staging url.
I am not able to resolve this. Also I am the owner of the heroku app.
There is only one git repo configured here, and that is a bitbucket git repo. You need to add the heroku configuration too. See this link for reference.
Ultimately, run something like heroku git:remote -a heroku-app-name -r staging. Then you can do git push staging master and it'll push to the given app.
Related
I run these commands
heroku create
git push heroku master
Then.
git remote add heroku https://git.heroku.com/radiant-chamber-18560.git
git push heroku master
What should I do?
Make sure you added and committed your code locally by
git add -A .
git commit -m "your commit message"
Then try sending you current git HEAD to heroku master branch instead.
git push heroku HEAD:master
From your error, it seems Heroku is not being able to detect you are deploying a RoR application. Make sure your Gemfile is being sent to Heroku (see here for more info). You can use #Felipe_Sabino's answer to make sure it is added to git.
Also you could set the buildpack manually, but it shouldn't be necessary if all files are correct.
Here is what I did:
Created a Ruby on Rails app.
Initialized empty git rep
Made changes to my app and saved them (git add -A and git commit -m "blahblah")
Deployed to Heroku.
But when I visit git hub it shows zero repos?
What did I do wrong?
I think you confound github and heroku.
It's two differents repository.
Deploying to heroku with something like this:
git push heroku master
does not affect your github account.
You can have several repository for the same project.
To add a repository:
git remote add NAME_OF_YOUR_REPO URL_OF_YOUR_REPO
(you can create a project in github, and they will git you a URL_OF_YOUR_REPO)
example:
git remote add origin https://github.com/user/repo.git
after you can do:
git push origin master
and you will see your commits on github.
I am collaborating on a project and cloned the repo from Github, made some changes and pushed to Heroku. Now the cloned app had all of its keys and passwords hardcoded, not in ENV variables.
So I created ENV variables, added the file to .gitignore. So this app still has these keys in the commit history. What I have done now is have the author create a new repo on Github, remove .git file from original app and push new code to new repo.
So now I have cloned the new app, added a new remote the the Heroku app.
heroku git:remote -a myapplication
My issue is I cannot push the new app to the existing Heroku app. When I do I get:
error: failed to push some refs to 'git#heroku.com:myapplication.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.
So a git pull says everything is up to date.
git remote -v outputs
heroku git#heroku.com:myapplication.git (fetch)
heroku git#heroku.com:myapplication.git (push)
origin git#github.com:author/myapplication.git (fetch)
origin git#github.com:author/myapplication.git (push)
What can I do to push the new application to the existing heroku app?
Update
I ran
git push -f heroku master
which pushed but I had error
you have not declared a Ruby version in your Gemfile.
To set your Ruby version add this line to your Gemfile:"
ruby '1.9.2'"
I've never had to specify before, and now all the original config vars that where set are no longer stored in Heroku.
git pull would pull by default from GitHub, which has all your commits already.
You might need to:
git pull heroku
clean-up the files (if the merge brings back the hardcoded values)
push to origin
push to heroku through the heroku command.
Git uses the concept of tracked branch to know which remote branch is linked to a local branch.
In your case, you probably have your local branch (I suppose it's master) linked to origin/master. So, when you do a git pull, Git is trying to get new stuff from git#github.com:author/myapplication.git, which is not the wanted behavior.
You have to change your tracked branch using :
git branch --set-upstream-to heroku/my_branch
Then, you can do a git pull which will now have the wanted behavior. Then just push to heroku, as you always do.
I am a collaborator on a Heroku app programmed in Rails I am getting this error when trying to push to the staging environment. I am only a collaborator on the staging environment of the application and not the production repo. When I try git push heroku master I get the following error:
Hugos-MacBook-Air:app_name hugo$ git push heroku master
To git#heroku.com:app_name-test.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#heroku.com:app_name-test.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.
I don't understand the information I am getting when enter the git help command. I have setup the remote heroku repo and I have logged in too. I have also added my ssh keys to heroku.
heroku git#heroku.com:app_name-test.git (fetch)
heroku git#heroku.com:app_name-test.git (push)
Above are the heroku repos. Also this is the repo that I have associated with the heroku app. git#github.com:app_name/app_name.git I haven't pushed to the github repo yet so is that my problem?
Can anyone be of assistance? I'd really appreciate it thanks.
You can run git fetch heroku && git merge heroku/master to be sure your local repo is up to date with your remote repo on heroku.
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