1. From the terminal, enter ssh-keygen at the command line.

    ssh-keygen
  2. Press the Enter key to accept the default location.

  3. Enter and re-enter a passphrase when prompted.

  4. Run the following code

    ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
  5. Copy the key that’s been created

    cat ~/.ssh/id_rsa.pub
  6. Copy contents

  7. Add key to bitbucket

    Settings > Access keys >Add key

  8. Paste key

  9. Create webhook in bitbucket

    Webhooks > Add webhook
    Title: Auto Deploy
    URL: http://bayroom.pinkpanda.com.au/deploy.php
    Active YES
    SSL NO
    Repository push YES

    SAVE

  10. Create php file deploy.php in root of website

  11. Add the following code to deploy.php

    $output=shell_exec('cd /bitnami/wordpress/wp-content/themes/bayroom && sudo -u bitnami git pull 2>&1');
    file_put_contents('deploy.log', date('m/d/Y h:i:s a') . " - " . $output . "\n", FILE_APPEND);


    (old bitnami instance url - /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/bayroom)
  12. If you have an existing theme, delete it.

  13. Clone your theme using SSH not HTTPS

    git clone git@bitbucket.org:pinkpandaau/cc-ajax-2019.git *FOLDERNAME*
  14. Install sudoers

    sudo apt-get install sudo
  15. Add the following items to sudoers via sudo nano /etc/sudoers

    daemon ALL=(ALL:ALL) NOPASSWD: /usr/bin/git
    daemon ALL = NOPASSWD: /usr/bin/git
  16. If it’s throwing an error, add the following line

    daemon ALL=(ALL) NOPASSWD: ALL