Skip to Content search facebook instagram pinterest twitter youtube

Git-deploy

The preferred method of deploying SproutCMS to a server is using git deploy. This allows you to precisely deploy changes from a git repository with a single command, via an authenticated secure channel (SSH), avoiding all the error prone, insecure, manual handling of FTP.

This method only works if your copy of SproutCMS code resides in a git repository (which it really should). If you're working from a release ZIP or other non-git method please refer to the FTP deployment guide, though we strongly discourage using FTP for deployment.

As per the instructions on git deploy setup is simple but you will require some basic knowledge of git; specifically a basic commit workflow, pushes and remotes. A great guide to using git is the official Git Book; chapters 2 and 4 are particularly relevant to this task.

The general process is to add a production git remote (i.e. the server address + server-side path where the deployed code will end up), run the git deploy setup task and then git push your code up to production. All the following commands are run on your developer system, not the server.

Requirements

  • SproutCMS source under Git version control
  • Ruby installed on the client (it is not required for the server)
  • Git installed on both client and server
  • A user with SSH access on the server
  • Basic Git knowledge
  • Basic Linux toolset knowledge (users, file system commands e.g. ls, mkdir etc) will likely come in handy

From your terminal of choice run the following commands while in the SproutCMS repository:

Step 1 - install the git-deploy gem

gem install git-deploy

Step 2 - add a production remote to your SproutCMS git repository.

This requires having an account with SSH access on the server, see chapter 4.3 + 4.4 of the Git Book for an introduction on this.
The second part of the production remote (after the ':') is the path; this is where the deployed code will reside. You can pick any path provided the web server has read access to that folder.

git remote add production 'username@server:/server/path/to/destination/folder'

Step 3 - run the git deploy setup task for the production remote

git deploy setup -r 'production'

Step 4 - push your SproutCMS code up the server using a git push

git push production master

This may take some time as the entire history of the repository will be pushed up to the server. Subsequent pushes however will only need to send the difference between the server and repository code so will be much faster.

After the initial setup has been completed the only command you will need to run is

git push production master

when you wish to send your commits up to the server.