Skip to content

Heroku Deployment through Github and Heroku CLI

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app.

Basic Assumptions

  • You want to deploy some straight-up HTML, CSS, JS, maybe a few images. Nothing fancy here.
  • You are in the root directory of your site (i.e. the directory that contains all subdirectories and files for the site)
  • The root directory contains a main HTML page, e.g. index.html
  • Heroku app and remote are set up and ready to go
  • You can download the source code from here
  • Clone the source code from git and extract your local machine.

Right-click and click on Git Bash

Follow the below Git commands as per the screenshot

Execute

$ git init

$ git remote add origin https://github.com/kumaresankandasamy/webapplication_master.git

$ git status

$ git add .

Execute

$ git commit -m "add webapplication master"

$ git push origin master

Next, Refresh your git repository web page.

Then, Login Heroku and click on create new app

Add a app name, region and click on create app

Then Click on Heroku Git CLI

open windows command prompt in the local root folder where you have cloned sourcecode and run the below commands.

Execute

heroku login

Press any key to open up the browser to login Heroku

Click on the login button and run the below commands on windows command prompt

Execute

git init

git:remote -a nmasterapp

git add .

git commit -am "make it better application"

git push heroku master

Build the package

Successfully deployed the package

Run the URL in a browser ClickHere

Another way, you can deploy your application connect to GitHub

Search and connect to your git repository

To enable automatic deployment

Click on deploy branch, now your application successfully deployed.

You can see the application in a browser ClickHere

Video Tutorial – Deploy in Heroku through Github and Heroku

Happy Learning !

Translate »