[Solved] How to deploy php app to heroku from windows


I am fulltime linux user and parttime windows user. Lately I have started working with windows for some project stuffs. I found windows quite frustating and limited to what linux provided me. Well it’s all personal feelings. I always hated unnecessary installations of extra applications for the same tools which most of the linux distributions provides us out of the box. For e.g. ssh-keygen. To emulate the most of the linux command we need to install cygwin.

I was working on a facebook application and had to deploy it to heroku. I could do this with few commands in ubuntu which already come with those commands preinstalled. I had to do nothing, just push and push as I had already added my SSH keys in heroku settings.

Basic walkthrough on how one can deploy the heroku app using git Bash shell.

To carry out this process you must have git bash shell installed. Download git for windows and install it.
Git Download Link

Download Heroku toolbelt for windows, Download Link for Heorku

Once downloaded install the heroku toolbelt. After installation is complete, you can set heroku path to the environment variable.

c:\set path=%path%;C:\Program Files (x86)\Heroku\bin;

Now start the Git bash shell.
Git bash shell

Note:We installed git bash shell because it already comes with ssh-keygen which is required to generate pair of our keys.

1. Generate SSH Keys for windows

$ ssh-keygen -t rsa

When asked for

Enter file to which to save the key(/c/Users/user/.ssh/id_rsa):
just hit enter then enter your password, re-enter your password.

See the screenshot below:
Generate SSH Keys for windows

You have successfully generated ssh keys and has been saved in location supplied above.

Now, you have to use those SSH keys with heroku. To do this first copy the contents of id_rsa.pub file exactly as it is. You will find this file in C:\Users\user\.ssh\, if you haven’t changed the default folder location while creating ssh keys shown above.

Now, Go to your heroku dashboard, scroll down under section SSH Keys, Click in Add new SSH Key, paste contents of id_rsa.pub here. Then click in Add key. You have successfully added your public key to heroku. Now is the time to test our key.

Also see the screenshot below:
Heroku SSH keys

Upload ssh keys to heroku

$ heroku keys:add

Try to login to heroku use the command shown below, Since we have already added heroku to path. This should work.

$ heroku login

See the screenshot below:
heroku login

If we are using heroku login for the first time, it looks for ssh keys and since we have already created SSH keys and have also added it to heroku, this should work as expected and give us authentication successfull message. That’s it.

2. Add heroku remote repository to the project

$ heroku git:remote -a survey2email-sam

See screenshot below:
Add git repository to heroku

3. After adding heroku remote confirm it. To confirm it use the following command.

$ git remote -v

git remote -v

4. Now push code commits

$ git push heroku master

Enter password that you used to create SSH Key pairs. Wait for a while, heroku is working on your requesting.
After few seconds/minutes depending on your sources you will be shown feedback what is going on. Now you can feel relaxed and have cup of tea.

Push git repository to heroku

Congratulations. You have successfully deployed your PHP app to heroku.

I have skipped some steps assuming that you have basic familiarity with git. The above command assumes that you have already added, commited your codes to repository and want to deploy them to heroku.

If you find any difficulty in following the walkthrough drop your questions in comment box below.

[Solved] Heroku- permission denied (publickey)


While trying to clone a git repository from the heroku I got the problem as shown in the screenshot below::
which mentions

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

[Solved] Heroku- permission denied (publickey)
After few googling, Then I found that I had to re-upload my public keys to heroku using the command listed below. I had to re-upload because I recently made few changes to my username/password.

$ heroku keys:add ~/.ssh/id_rsa.pub

id_rsa.pub is the public key generated using the command.

$ ssh-keygen -t rsa -C "your_email@domain.com"

After adding the keys to heroku. I was able to clone the heroku repositories as before. I hope this helps someone.

[Solved] Heroku login problem for heroku facebook app


Heroku provides the free webhosting for facebook applications. If you want to know more about Heroku you can visit their sites. They have very good introduction. From October 1, 2011, see here https://developers.facebook.com/blog/post/497/ Facebook required the https connection for Facebook application and Heroku freely provides it. Great. Thanks to Heroku.

This guide is for Ubuntu only and was prepared with Ubuntu11.10.

Recenlty, I was trying to use the free hosting provided by Heroku. This is something which according to my experience have to say is difficult for newbies. I will suggest to heroku with Ubuntu.

Anyway, the actual that I got while installing heroku was this.

samundra@mystic-angel:~$ heroku login
/home/samundra/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- readline (LoadError)
	from /home/samundra/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/gems/heroku-2.29.0/lib/heroku/command/run.rb:1:in `<top (required)>'
	from /home/samundra/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /home/samundra/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/gems/heroku-2.29.0/lib/heroku/command.rb:15:in `block in load'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/gems/heroku-2.29.0/lib/heroku/command.rb:14:in `each'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/gems/heroku-2.29.0/lib/heroku/command.rb:14:in `load'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/gems/heroku-2.29.0/lib/heroku/cli.rb:24:in `start'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/gems/heroku-2.29.0/bin/heroku:16:in `<top (required)>'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/bin/heroku:19:in `load'
	from /home/samundra/.rvm/gems/ruby-1.9.2-p180/bin/heroku:19:in `<main>'

The issue is with the readline package used by the heroku. I had ruby1.9.2 which wasn’t compiled with readline.

So, to solve this I first installed the readline package.

samundra@mystic-angel:sudo apt-get install libreadline-dev

Then cd to the directory

samundra@mystic-angel:cd ~/.rvm/src/ruby-1.9.2-p180/ext/readline

and then compiled the extension manually.

samundra@mystic-angel:ruby extconf.rb
samundra@mystic-angel:make install

That’s it. If you are having problem following the instruction, please post them in comment. I will try to reply them as soon as possible.