Skip to content

Deploying Your Application With Git

Deploying any application is incredibly easy with Git, which comes installed in every Webslice Container image.

Generate an SSH Key

Start by generating an SSH key for your Container, using this command:

ssh-keygen -t rsa -b 4096

Press Enter every time the commands asks for input.

Add Your SSH Key to Git

Get your newly created SSH key with the following command:

cat ~/.ssh/id_rsa.pub

Copy the output of the command and go to your GitHub/GitLab/Bitbucket account settings. The process is very similar for each of these options.

Through Settings find the SSH Keys option, then New SSH Key.

Enter a title, then paste in the new SSH key which you copied earlier.

Clone Your Repository on to the Container

Now you can clone your project into your Container. SSH into the Container to begin.

If you want to check that Git is installed on your Container, run this command:

user@ch-test:~$ git --version
git version 2.25.1

Usually, your application should be located on the /container/application/ directory. Head here to clone your project.

cd /container/application/

Clone your project to the Container. The dot at the end of this command tells Git to clone the project in the current folder:

git clone git@github.com:your-username/project-name.git .

You ought to see a successful result like this:

Cloning into '.'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done.

Updating Your Project

Now every time you wish to update your project, you can use the git pull command.

If you are making changes on the Container and want to commit your changes to the repository, you will get the Please tell me who you are message. To set your identity on the server, run the following commands with your actual username and email address:

git config user.name "Your Username"
git config user.email "Your email"