Deploy with Git

To deploy with Git you’ll have to create a new application on Scalingo. A Git repository will be automatically created. Every push on the master branch of this repository will trigger a new deployment.

How to Create an App

# Create app with the CLI (or create one from the dashboard)
scalingo create my-app

# Setup the Git remote:
git remote add scalingo

Note that the remote URL depends on the region of your application. You can get it using our CLI with:

scalingo --app my-app git-show

Deploy your application:

git push scalingo master
# OR
git push scalingo main

Deploy with Another Branch than Master and Main

If you want to deploy another branch than master and main:

# Here we want do deploy 'mybranch' which is a local branch
git push scalingo mybranch:master
# OR
git push scalingo mybranch:main

Deploy a Previous Version of an App

If you want to deploy a version of your code that is not the current head of master, you first need to get the commit ID with git log. Then:

git push --force scalingo <commit ID>:refs/heads/master

Git Authentication and SSH

The Git server created by Scalingo uses SSH authentication. If you have any problem setting up SSH please read Troubleshooting git push and SSH common issues.

And After?

See Deployment Environment to configure your application and Procfile.

Clone Your Code

Once a deployment has succeeded, you can recover the code you pushed to Scalingo using:

git clone --origin scalingo

This will create a copy of the Git history hosted in Scalingo repositories. It will also add the scalingo remote to simplify future pushes.

Shallow Error

Currently, Scalingo does not support update of shallowed repository (i.e. from a git push). The shallow error means that the pushed repository on Scalingo does not contains all its history. The error can happen whether you are pushing from your workstation or from an online worker.

It is often the result of a clone with the Git parameter --depth.

To be able to push the modifications, you need to first unshallow the repository. For that purpose, please follow the instructions below.

From Your Environment:

You need to get all the repository history with the command:

git fetch origin master --unshallow

Then retry to push your code with:

git push scalingo master

From the Continuous Integration

Some CI offers you the possibility to disable shallow repository by disabling the parameter depth from configuration file.

  • with travis:

    # .travis.yml
      depth: false
  • with GitLab CI:

    # .gitlab-ci.yml
      GIT_DEPTH: 0

If the problem persists, you must surely run the following Git command once:

git fetch origin master --unshallow

Suggest edits

Deploy with Git

©2022 Scalingo