Deploy over SSH
To configure CircleCI to deploy your application over SSH, follow the steps below.
Add the SSH key for the server to which you’re deploying. For instructions, see the Adding an SSH Key to CircleCI document.
Add the SSH username and SSH hostname of your build VM as environment variables. For instructions, see the Set an environment variable in a project documentation. In this example, these variables are defined as
.circleci/config.yml, create a
deployjob and add a command to deploy the main branch.
version: 2 jobs: build: #... deploy: machine: enabled: true steps: - run: name: Deploy Over SSH command: | ssh $SSH_USER@$SSH_HOST "<remote deploy command>" workflows: version: 2 build-and-deploy: jobs: - build - deploy: requires: - build # only deploy once build job has completed filters: branches: only: main # only deploy on the main branch
Help make this document better
This guide, as well as the rest of our docs, are open source and available on GitHub. We welcome your contributions.
- Suggest an edit to this page (please read the contributing guidefirst).
- To report a problem in the documentation, or to submit feedback and comments, please open an issue on GitHub.
- CircleCI is always seeking ways to improve your experience with our platform. If you would like to share feedback, please join our research community.
Our support engineers are available to help with service issues, billing, or account related questions, and can help troubleshoot build configurations. Contact our support engineers by opening a ticket.
You can also visit our support site to find support articles, community forums, and training resources.
CircleCI Documentation by CircleCI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.