This article is about Codeship Pro.

Deploying With SSH

You will need about one minute to read this article.

Using SSH/SCP To Deploy

To deploy using SSH and SCP with Codeship Pro, you will need to create a container that can connect to your server via SSH. Then, you will pass this container the necessary deployment commands.

Please follow our outlined steps on setting your private SSH key before proceeding

Deploying

After the private SSH key configuration is complete, you can add SSH/SCP deploy commands to the codeship-steps.yml file:

- name: Copy Files
  service: app
  command: scp -r /app/ user@myserver.com:app/
- name: Restart Server
  service: app
  command: ssh user@myserver.com restart_server

Common Problems

Authentication Failure

If your SSH authentication commands are failing, there are several troubleshooting steps to take.

  • First, try connecting using that key locally to verify the key and the corresponding public key are configured and working as intended.

  • Next, try running your deployments locally with our local CLI tool to see if you receive the same error messages.

  • Ensure that your target endpoints are acknowledged in your $HOME/.ssh/known_hosts.

  • Often times these issues are related to character escaping or issues loading the key into the proper directory, so running printenv and ls commands will help you verify that the correct key has been loaded and that it is where you want it to be.

Need more help?

You can post on Stack Overflow using the tag #codeship or contact our Helpdesk.
We also have a couple of code examples and sample projects available for you to get started with.

Article not helpful?

Do you think we need to improve this article? If so, please submit our feedback form to help us improve this article!