lichess.org
Donate

How to deploy a repository to heroku?

Software DevelopmentOff topic
A simple way to Deploy a repository to Heroku using Gitpod

Recently Heroku depreciated GitHub deploys through the UI, hence heroku users have to use Heroku CLI.

Here I'm explaining a simple way to do this through Gitpod.io.

Step 1: Prerequisites

You need to have a Gitpod account and all necessary Gitpod permissions enabled through Github (link). Only once this is ready you can start.

Step 2: Open Gitpod

Now you simply need to open gitpod for the repository that you want to deploy to heroku. To do this, the link to gitpod would be https://gitpod.io#<repository-url>, where you replace <repository-url> with the entire url of your repository (including https://). Below is an example url:

https://gitpod.io/#https://github.com/TheYoBots/Lishogi-Bot

Once you've opened gitpod, it might take a while to load completely and once it opens too the terminal might have some commands that are running. Wait for all of this to finish and then continue to the next step.

Step 3: Install Heroku CLI

To deploy a repository into a heroku app you need to install Heokru CLI. There are many ways to do this, but a simple way to do this is through npm.

npm i -g heroku

Wait for the installation to complete.

Step 4: Login to Heroku

You need to login to heroku now through Heroku CLI.

heroku login -i

Once you enter the above command you will be requested Email and Password. When email is requested, enter your email ID associated with your Heroku account and when password is requested, enter your Heroku account password.

Step 5: Add a Git remote associated with your Heroku app

Simply type the following command next:

heroku git:remote -a appname

In the above command appname should be replaced with the name of the Heroku app that you have created. This commands adds a git remote with the name heroku and sets it to your heroku app.

Final Step: Deploy your Heroku App

This is the final step and this can be done by typing the following command:

git push --force heroku branch:master

In the above command branch must be replaced with the name of the branch in your repository that you are deploying to Heroku. If the branch is master, it should work even if you simply type git push --force heroku master, but it might not work sometimes so if that fails enter git push --force heroku master:master. The same is applicable if the branch is main.

Now your Deploy to Heroku should start!