Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dotherightthing/401da611b077747f328817136bbc2f83 to your computer and use it in GitHub Desktop.
Save dotherightthing/401da611b077747f328817136bbc2f83 to your computer and use it in GitHub Desktop.
[Automate deployments from a Bitbucket repository to Sitehost using Git FTP] #bitbucket

Automate deployments from a Bitbucket repository to Sitehost using Git FTP

Created 2017.05.30

https://www.savjee.be/2016/06/Deploying-website-to-ftp-or-amazon-s3-with-BitBucket-Pipelines/

First up, create the Environment variables in your Bitbucket account:

  • FTP_USERNAME_DEV: As generated by Sitehost
  • FTP_PASSWORD_DEV: As generated by Sitehost
  • FTP_SERVER_PATH_DEV: ftp://120.138.19.15/public/ (for Sitehost)

This is the bitbucket-pipelines.yml file that I use in all Bitbucket projects:

# Bitbucket Pipeline configuration
# Runs on a Docker image
# Note: use only spaces to indent
#
# See https://www.savjee.be/2016/06/Deploying-website-to-ftp-or-amazon-s3-with-BitBucket-Pipelines/
# See https://confluence.atlassian.com/x/5Q4SMw for more examples.
#
# Uses https://github.com/git-ftp/git-ftp
# Initial upload of all files:
# - git ftp init --user $FTP_USERNAME_DEV --passwd $FTP_PASSWORD_DEV $FTP_SERVER_PATH_DEV
# Update with only files from the latest commit:
# git ftp push --user $FTP_USERNAME_DEV --passwd $FTP_PASSWORD_DEV $FTP_SERVER_PATH_DEV

image: samueldebruyn/debian-git

pipelines:
branches:
development:
- step:
script:
- apt-get update
- apt-get -qq install git-ftp
- git ftp init --user $FTP_USERNAME_DEV --passwd $FTP_PASSWORD_DEV $FTP_SERVER_PATH_DEV

GoDaddy

I have a client that uses GoDaddy's WordPress Managed Hosting. Initially I had problems getting this to work with GoDaddy, and I tried all sorts of path combinations before I realised what the problem was:

  1. GoDaddy uses SFTP, so you must use the sftp:// protocol in your Bitbucket environmental variable. not ftp://
  2. SSH must be enabled in GoDaddy's Basic settings
  3. The path is /home/SFTPusername/html/wp-content/themes/mytheme (this was already correct)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment