Update an existing app - heroku

I have a Django-cms website running online on Heroku. I pushed this online from a device at work. Now I'm at home and I have same project running on my machine and I did some changes and I wanna push them live on the same link.
What I need to do?
git init
git add .
heroku create
that gonna create an other link , but I wanna push my amends on the same link I have already.
Any idea?

You need to get add the Heroku git remote to your new application. Grab the app's git repo from the apps page in Dashboard and then do;
git remote add heroku <git repo here>
and then you'll be able to push as you are able to on the other machine.

ok I didn't add my public key I did:
heroku keys:add ~/.ssh/id_rsa.pub
and it worked! :)

Related

Don't have access to Heroku app

I have a mystery app in Heroku. It's called weird-app-5536
When I try to push my code to Heroku I get this message:
Your account my_email#geemail.com does not have access to weird-app-5536.
!
! SSH Key Fingerprint: *************************************************
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When I try...
heroku apps
I get a list of my apps, but it does not include the mystery app, weird-app-5536.
I can't destroy or rename the weird-app-5536 app. It always says I don't have access.
The app does not appear on my list of apps on the Heroku website.
When I type
git remote -v
I get this:
heroku git#heroku.com:weird-app-5536.git (fetch)
heroku git#heroku.com:weird-app-5536.git (push)
origin git#github.com:thisisme/my_code.git (fetch)
origin git#github.com:thisisme/my_code.git (push)
I deleted my old ssh keys. I created a new one and added it to Heroku
I can create new apps and they show up on my list of apps.
As far as I know I only have one Heroku account.
Stumped. I don't know where to go from here.
What's happened is the git repo on which you're working is tied to an old remote. No need to contact heroku or anything... Just remove the heroku git remote and readd it.
Remove by running:
git remote rm heroku
Readd with:
heroku git:remote -a appname
More here: https://devcenter.heroku.com/articles/git
Honestly, I would try to get a hold of Heroku support. It might be possible that you were listed as a contributor to another app by someone but weren't given write access? Heroku support is probably your best bet.

Deploy to heroku directly from my github repository

How can I deploy my app to Heroku directly from my GitHub remote repository?
Does a command for that exist, like this?
heroku push https://github.com/user/repository.git
Any tips? Tricks?
You can put services in between Github and Heroku which may achieve a similar result to what you want.
There are presently two addons in the Heroku Addon library which would be able to do this for you via Continuous Deployment.
Codeship.io (https://addons.heroku.com/codeship)
wercker (https://addons.heroku.com/wercker)
Basically, when you add and setup these addons they install a webhook into your projects github repo and then when you push to the repo, the webhook is triggered which triggers the service to grab your code (run tests if you want) and then push the code to Heroku.
Heroku recently added option to synchronize deployment with GitHub
There is no way to push from one git remote to another. You will have to clone from github and then push to heroku.
snap-ci is an easy way to setup a deployment pipeline from Github to Heroku
git clone git://github.com/heroku/ruby-sample.git
cd ruby-sample
heroku create
git push heroku master
heroku open
It was as default example from heroku. You can get an idea. right ?
Create a 'Deploy to Heroku' button and include in the README - https://devcenter.heroku.com/articles/heroku-button

git push heroku master Permission denied (publickey)

Edit #3
Updating this at the top because it solved my issue and gave me a good troubleshooting step I didn't know about (and could save you some time, too)
Try getting the output of ssh -vvv git#heroku.com. For me, ssh was getting hung up on trying keys in /c/Program Files (x86)/Emacs/.ssh when my public key was in /c/Users/NumberOverZero/.ssh
Deleting the Emacs ssh folder (which was empty) fixed my issue since ssh would then check my Users .ssh folder.
I'm getting Permission denied (publickey) when trying to git push heroku master.
A few things that makes this different from the posts below:
I have ssh working for github
I was able to successfully push to heroku last night
Since that push, I've made a single-line change to one js file, and committed and pushed. There have been no other changes.
The closest I could find was this post:
git clone heroku ssh permission denied
I've looked through the related issues (there's quite a few):
git push heroku master Permission denied (publickey). fatal: The remote end hung up unexpectedly
git push heroku master permission denied
git clone heroku ssh permission denied
https://stackoverflow.com/questions/13059076/git-push-permission-denied-publickey-windows-xp
heroku - rails - Permission denied (publickey)
I've tried:
heroku keys:clear
heroku keys:add
heroku keys:clear
*delete every key in .ssh*
heroku keys:add
*delete my application on heroku*
heroku keys:clear
heroku login (adds key for me)
heroku create
git push heroku master
fails
*delete the app on heroku*
delete keys in .ssh
heroku keys:clear
copy all files into a new repository
push new repository to github successfully
heroku login (adds github key for me)
heroku create
git push heroku master
fails
*delete the app on heroku*
heroku keys:clear
heroku login (adds key for me)
heroku create
heroku git:clone app app
fails
Any ideas? I've gone through all of the steps in the linked SOs - most of which were just people not running heroku:add or setting up ssh keys (which I've done in each of these).
I let heroku take the wheel most of the time, (instead of directly creating ssh keys) assuming that the built-in commands would do what they needed when there were no ssh keys present. It seems not.
EDIT: And now that I deleted the app, the new relic addon is alarming that the website is down. Trying to log in through their website asks me to log in through heroku. Which I can't find a way to do, since the app is gone. Is there a way to delete that addon now that I can't get to the app? heroku addons gives an error, so I don't think I'm getting to it through there.
EDIT #2: Added another step I tried - moved files into new repository and push to new application.
I had the same problem for Windows 7 box and found the solution here: http://www.gmarwaha.com/blog/2011/05/18/heroku-trouble-with-windows-and-ssh-keys/
Solution: Typically once you create the keys as mentioned above, two files – “id_rsa” and “id_rsa.pub” – are stored in the “.ssh” folder
within the user’s home folder. If you are working with linux that
seems to be good enough. But for the windows version of git that
doesn’t seem to cut it. It wants the keys to be stored inside the
“.ssh” folder within the “msysgit” installation folder as well. If you
don’t find a “.ssh” folder inside the “msysgit” installation folder,
feel free to create one. Once you drop these two key files there and
repeat the entire process, everything went as smooth and my
application got deployed in the heroku cloud and the world is again a
better place to live in.
In my case, I have to find where git.exe was installed, which is C:\Program Files\Git\. So here are the steps:
Create .ssh folder inside C:\Program Files\Git\
Copy id_rsa and id_rsa.pub from your home folder (C:\Users\username\.ssh\) to C:\Program Files\Git\.ssh\.
Try again with C:\dev\heroku\sample-app> git push heroku master.
Nice job linking to all the other things you've looked at and tried! (that will improve the responses you get, but still you should be prepared for a lot of 'have you tried...', and 'maybe it's ...' because this is a system/env issue that isn't on the normal flow)
You might have had something working in your local terminal session that has since been lost. (I've had this happen a bunch of times)
Things it might be:
your ssh keys on heroku
your ability to push up to heroku from that computer/network
something about your git repo
I ran into this once and it was driving me crazy. I hopped on my (FREE) cloud9 account, cloned some simple rails app from github and pushed it out to heroku, which helped me prove that my heroku account was fine, heroku itself was fine, but my local laptop had some issues in my configuration.
I think the issue was my username, but I don't remember. (moving to a different env and starting from scratch helped me realize the issue though)
The main reason you get this message is because you do not have ssh-keygen added to your environment variables.
This command is located in the bin-directory of Git program files.
You should add that bin directory to your environment variables.

How to attach my repo to heroku app

I create a heroku app and then my machine crashed. I have a new machine. How do I attach my existing app to heroku app. When I visit heroku page the url for my app is like this
git#heroku.com:myapp.git
I can't do clone this app because I already have myapp from github. So I need to add heroku as remote to my existing github app. Anyone knows the syntax.
If you've heroku toolbelt:
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
Credits: user101289's solution
Else if you don't have heroku toolbelt:
First do this:
git remote add heroku git#heroku.com:{heroku-app-name}.git
Then do this:
git push heroku master
heroku open
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
If you're using just Git without installing the Heroku Toolbelt, you can also create a new application.
Login to your account and go to this link
https://dashboard.heroku.com/apps
Look at the plus sign on the top right corner then select
Create new app
Leave the application name blank to let heroku choose one for you.
Let say your heroku app name is new-app-xxxxx, so to test on adding a file in to it you may try the following command:
git clone https://git.heroku.com/<new-app-xxxxx>.git
cd <new-app-xxxxx>
echo "my test file" > test.txt
git add .
git commit . -m "my test on commit"
git push
Put empty (blank) when the Git prompt for username, and your API Key for the password. You can get your API Key by showing it from the link below.
https://dashboard.heroku.com/account
Note: You cannot authenticate with the Heroku HTTP Git endpoint using your Heroku username (email) and password. Use an API key as described here.

How can I pull an existing heroku app to new location for development?

I currently have the latest version of my code on another computer that I want to develop from (Home computer and laptop for when I'm out and about) I set up heroku for my app on my laptop. Now I need to associate my code on my desktop so that I can push to heroku from there as well.
This is what I get from my desktop:
desktop:~/NetBeansProjects/onlinescheduler$ git pull heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
I can't do heroku create because that will create a separate app. How do I associated the existing code with (or pull down a brand new version from) heroku?
Whats the command to do this?
Also, If you've never used heroku before on the other machine, you'll need to do a few more things first:
$ gem install heroku
$ heroku login
[then enter your credentials]
$ heroku keys:add [path to keyfile]
Now you can clone the remote repository:
$ git clone git#heroku.com:<heroku_app>.git <local_directory>
First of all, you'll want to follow the Quick Start instructions for Heroku, which you can get straight from the horse's mouth, right here: https://devcenter.heroku.com/articles/quickstart
Once you've gotten through step 3, come back here.
Then, you can type this into the command line:
heroku git:clone -a myapp
This is described here:
https://devcenter.heroku.com/articles/git-clone-heroku-app
Then, if you want to grab the database too, here are some options.
Newer Heroku instructions on import/export:
https://devcenter.heroku.com/articles/heroku-postgres-import-export
Older heroku instructions on push and pull: https://blog.heroku.com/archives/2009/3/18/push_and_pull_databases_to_and_from_heroku
If you are using mongo, this is a useful tool to sync your mongo database: https://github.com/pedro/heroku-mongo-sync#readme
If you first need to get the app from Heroku, clone your app.
To do that, write in your Terminal:
heroku git:clone -a your_app_name
If you already have the app and the remote to heroku follow the next steps. If not, you can check instructions here https://devcenter.heroku.com/articles/git
Find the name of your database
Write in your Terminal:
heroku pg:info -a your_app_name
it will look something like this:
HEROKU_POSTGRESQL_MAROON_URL
Find the name of your local database
In your Rails app go to config/database.yml
it will look something like this:
your_app_name_development
Clone your production database (PostgreSQL)
Write in your Terminal with your own database names:
heroku pg:pull HEROKU_POSTGRESQL_MAROON_URL your_app_name_development -a your_app_name
HEROKU_POSTGRESQL_MAROON_URL is an example of how could be the name of your production database (in Heroku):
my_app_name_development is the name of your development database (locally)
the_name_of_my_app is the name of your app in Heroku
Don't forget to finish this with bundle install...
If you already have your code base ready and have heroku setup, use:
$ heroku git:remote -a your_heroku_app
This will allow you to deploy from your new location.
Reference: https://devcenter.heroku.com/articles/git#creating-a-heroku-remote
Once you create a key in a new computer, you have to upload your new SSH key by typing heroku keys:add.

Resources