The easiest way to deploy your app through SSH and Git

Things are really getting exciting over here! Today we're releasing a subtle, yet important update to the Shell deployments. This enhancement is going to make setting up your automated deployment process even easier.

We support many types of deployment in DeployBot — you may upload your updated files through FTP/SFTP, push them to a cloud hosting like Elastic Beanstalk or Heroku, or even connect to your server through SSH using our Shell deployments, allowing you to execute arbitrary commands necessary for your deployment, without us uploading anything. It's the Shell deployments we're going to be talking about today.

With this update, the SSH key we're already using to fetch updates from your repository is made available in the server you deploy to. This means that you can issue any command against your Git repository directly from the server without any extra effort. Read on for the details!

To show how easy all of this works with DeployBot, I will guide you through the process of setting up a deployment using this technique. But first, don't forget to sign up — it's free.

Now that you're in your account, connect your repository from GitHub, Bitbucket or your Gitlab setup. It is incredibly easy:

Connect repository

Once your repo is initialized, which in most cases takes less than a minute, you should be good to go to create your first deployment environment. In our case we'll use “Staging” as an example:

Create an environment

Now, we are ready to set up a basic Shell deployment server with the SSH connection details that we got from our hosting provider:

Set up a Shell deployment server

And here comes the most interesting part: DeployBot already has the key to access your Git repository when you gave it the permission before, now that same key will be available in the deployment session when the commands will be run on your server. This means you can use the following commands and they will work out of the box, as long as your server has Git installed:

Deploy through SSH and Git

And that is it. Git will magically know how to authenticate to your GitHub or Bitbucket repository and your deployment is now ready to go!

With a little magic from the ssh-agent forwarding built-in into the amazing OpenSSH technology stack, we are able to securely forward our key to your server to make your life easier. We really hope you enjoy this simple, but efficient way to deploy. We love getting feedback, so let us know what you think!

One more thing: We've also enabled SSH key forwarding for your DigitalOcean and SFTP deployment servers, so you can call Git from your pre/post-deployment commands knowing that your key will be available there, as well.

Comments