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 git@ssh.osc-fr1.scalingo.com:my-app.git
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 git@ssh.osc-fr1.scalingo.com:my-app.git
This will create a copy of the Git history hosted in Scalingo repositories.
It will also add the scalingo
remote to simplify future pushes.
Known Issue with Master Branch
If you have the following message when doing a git clone
:
warning: remote HEAD refers to nonexistent ref, unable to checkout.
It means that you’re using the master
branch. Since the default branch is now
main
, git
doesn’t know that you’re using master
branch instead of main
.
You need to manually checkout to the right branch inside the Git repository with:
git checkout master
to retrieve the content of the repository.
Or if you want to avoid this error when doing the git clone
command you can
add --branch master
argument, like this:
git clone --branch master git@ssh.osc-fr1.scalingo.com:my-app.git
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 git: depth: false
-
with GitLab CI:
# .gitlab-ci.yml variables: GIT_DEPTH: 0
If the problem persists, you must surely run the following Git command once:
git fetch origin master --unshallow
Sending Tags
Currently, Scalingo does not support sending tags to Scalingo Git server (i.e. from a git push
).
The error can happen whether you are pushing tags from your workstation or from an online worker.
You can also have an error when pushing tags with the push.followTags
Git option enabled.
If you want to push on Scalingo, you need to disable this Git option.
SSH Endpoints
- osc-fr1:
ssh.osc-fr1.scalingo.com
- osc-secnum-fr1:
ssh.osc-secnum-fr1.scalingo.com