Git : how to deploy website directly to FTP server using bitbucket pipeline

Deploy website directly to FTP server using bitbucket pipeline.

Bitbucket pipeline: In this blog, we will see how we can upload the complete site from our bitbucket account to our FTP server directly using bitbucket pipeline, before starting let me tell what are the prerequisites. you need a simple website, an FTP server, a bitbucket account.

let us suppose that you have a website that is over to bitbucket.  here are the steps to upload the website from bitbucket to FTP server using bitbucket pipeline.

Step 1:

open bitbucket and select your project, and then open pipelines for your project to enable it.

Bitbucket pipeline
Select project and enable pipeline for the project
Step 2.

Now select the programming language template of your website, and after selecting it you will see a  bitbucket-pipelines.yml file, with a sample of code in it. replace the code with the below code:

image: samueldebruyn/debian-git

pipelines:
default:
– step:
script:
– apt-get update
– apt-get -qq install git-ftp
– git ftp init–user $FTP_USERNAME –passwd $FTP_PASSWORD ftp://ftp.xyz.com/public_html

language template
Select the language template
 bitbucket-pipelines.yml file with sample code
bitbucket-pipelines.yml file with sample code
Step 3.

Now declare your variables FTP_USERNAME and FTP_PASSWORD. Go to settings>Environment variable and place up the variables.

environmental variables
Environmental variables for pipeline
Step 5:

Now go to pipelines and commit and execute the file. and your files will be deployed to your server.

execution
Execute the .yml file
Step 6:

After the successful execution of the pipeline please make sure to change the syntax in the pipeline from “init” to “push” as now our code is initialized and now we will have to just push the code.

so the complete new .yml syntax will be :

image: samueldebruyn/debian-git

pipelines:
default:
– step:
script:
– apt-get update
– apt-get -qq install git-ftp
– git ftp push –user $FTP_USERNAME –passwd $FTP_PASSWORD ftp://ftp.xyz.net/public_html

 

So we have uploaded our first website to FTP using bitbucket pipeline. Let us know your query by comment below. If you liked the article share it to help others.

This blog is developed by team skydevelopers

5 Comments on “Git : how to deploy website directly to FTP server using bitbucket pipeline”

  1. Hello there, just became aware of your blog through Google, and found that it is truly informative.
    I’m gonna watch out for brussels. I’ll be grateful if you continue this in future.
    A lot of people will be benefited from your writing. Cheers!

  2. Hey there! I’m at work browsing your blog from my new iPhone!
    Just wanted to say I love reading your blog and look forward to all your posts!
    Keep up the great work!

  3. I like the helpful information you supply to your articles.
    I will bookmark your weblog and take a look at again right
    here frequently. I am slightly certain I will be told many new stuff right here!

    Best of luck for the next!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.