All Collections
Jelastic
SSH
SSH Access to GIT Repository
SSH Access to GIT Repository
Updated over a week ago

With Scaleforce it becomes very easy to deploy your application from any remote public or private GIT/SVN repository on all of the supported programming languages: Java, PHP, Ruby, Python, and Node.js.

To improve the security, you can also access your private GIT repositories via SSH to clone and update your applications from them. Like this, it becomes handy to work with the repositories, which are located at the private servers, instead of common web-based hosting services for projects like GitHub, GitLab, Bitbucket, etc..

You can use the secured SSH protocol to access your private GIT repositor, as shown below:

1- Generate SSH Keychain

Firstly, create an SSH key pair (e.x.. two related keys: private and public) to bind your GIT repository to the Scaleforce account. Follow the Generate SSH Key instruction if you have never generated a keychain before.

Important!: Your keys must not contain password protection (passphrase) so you can use them to establish a connection between Scaleforce Cloud and GIT accounts.

2- Add Private SSH Key to Scaleforce Account

Uploaded your private key to your Jelastic account, then adjust your GIT repository account.

If your GIT repository is located at the remote private server, just upload the appropriate SSH public key and add it to the list of the authorized ones.

If you are using some web-based projects' hosting service, follow the corresponding detailed step-by-step guide below. For illustration purposes, we will pay attention to the three most popular services:

GitHub

1- Log in to your GitHub account. Go to Settings (at the top right corner), choose the SSH and GPG keys from the panel on the left, and click on the New SSH key button.

6-Github-ssh-keys-settings.png

2- Set a Title for your key, paste your public SSH key to the Key, then click Add SSH key.

7-Github-add-public-key.png

3- Confirm and type the password for your GitHub account in the opened frame.

8-Github-confirm-key-addition.png

4- Your newly added key will appear in the same SSH keys tab.

9-Github-ssh-key-added.png

5- Log in, choose the desired repository and switch the link type to SSH in the clone URL section at the right-hand pane. Then click on the Copy to clipboard button (or do it manually), to get the SSH link to your project.

10-Github-copy-git-link.png

GitLab

1- Log in to your GitLab account. Go to Settings (at the top right corner), then, go to the SSH Keys tab at the menu to your left.

11-Gitlab-ssh-keys-settings.png

2- Paste your public SSH key to the Key, set a Title, add Expires at date (optionally) for your key, then

click the Add key.

Important!: The expiration date serves to inform only and does not prevent you from using the key. For example, it can be used by administrators to keep keys rotating.

12-Gitlab-add-public-ssh-key.png

3- Your key will appear in the Your SSH keys list as below:

13-Gitlab-ssh-key-added.png

4- Login, choose the desired repository, expand the Clone menu, and copy the Clone with SSH link, to get the SSH link to your project.

14-Gitlab-copy-git-link.png

Bitbucket

1- Log in to the Bitbucket account, choose the Manage Account option from the user?s settings menu at the top right corner of the page.

15-Bitbucket-manage-account.png

2- Switch to the SSH keys tab (inside the Security section) using the left-hand categories list. Then, select Add key.

16-Bitbucket-ssh-keys-settings.png

3- In the appeared frame, paste your public SSH key to the Key input field, set a Label for your key, then, click the Add key.

17-Bitbucket-add-ssh-key.png

4- Your new key will appear in the same SSH keys tab.

18-Bitbucket-ssh-key-added.png

5- Login, choose the desired repository?s overview screen and switch the link type to SSH within the drop-down list at the top of the page. Copy the shown string, to get an SSH link to your project.

19-Bitbucket-copy-git-link.png

Deploy Project via SSH

Finally, you can proceed to your project?s deployment via a secured connection.

1- Go to the Deployment Manager at the bottom of the dashboard and click Add repo. Provide the following information:

  • Name - the name of your application (no spaces and special symbols are allowed)

  • URL - the appropriate git URL to the repository

  • Branch - the required branch of the project (master by default)

  • Tick the Use Authentication check box, choose the SSH Key option as your Access Type, and Select Key from the list

20-Add-repository-with-ssh-key-authentication.png

Click Add to save your project information.

2- Once the project is added to the Deployment Manager, hover over it and click

the Deploy to button to deploy your application.

In the window, specify the deployment target and some additional configs like:

  • Environment - chose a target environment from the list

Important!: For Java-based environments, select additional a build node.

21-Java-projects-build-node.png
  • Path - type the context you would like your application to be deployed to (or leave the default one)

  • Hooks - add pre-and post-deployment operations (if needed)

  • Check and auto-deploy updates - enables automatic periodic updates of your project from the repository (performed only if there are code changes) with a set interval

  • Auto-resolve conflicts - prevents the merge conflict, the ?git reset ?hard? command will be called during each subsequent project update (contradictory files will be updated according to its repository version, discarding the locally made changes)

  • Enable zero-downtime deployment - adjusts the deployment flow to avoid application downtime (for PHP servers only)

22-Deploy-git-project.png

Click Deploy to proceed and wait until your project is successfully deployed.

3- You can ensure your project files are now available. Open the Configuration File Manager for your environment, go to the webroot directory, and check a folder named after the specified context (ROOT by default) inside.

23-Example-application-files.png

4- Finally, you click on Open in Browser for your environment and ensure your application is running.

24-Open-in-browser-button.png

You are all set!

Did this answer your question?