Automated Code deployment from Bitbucket

Kevin Kariuki
Oct 16, 2020


In this article, we are going to set up a bitbucket repo from where we will use bitbucket pipelines to code deploy artefacts/files to your server via SCP or rsync.


  1. BitBucket repo with write access or admin
  2. A compute engine with ssh and sudo privileges

We are going to Create a user kramer in our server where we want to deploy the artifacts

Create a user with write document permissions

We are going to create a user called kramer and add the user to the apache group.

sudo useradd -G kramer

We set up a new password for the new user kramer that we have created.

sudo passwd kramer

Manage Document permissions groups

sudo chgrp -R apache /var/www/htmld

Set the permissions

Next, we make the document root group-writable, but we’ll also want to set the “setgid” permission on the document root directory itself. The setgid permission will ensure that new files created in the document root will inherit the group ID from their parent directory.

sudo chmod -R g+w /var/www/html

sudo chmod g+s /var/www/html



Kevin Kariuki

Recommended from Medium