Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

push from bitbucket repository to shared hosting ftp server

Tags:

git

bitbucket

ftp

I am using Bitbucket for managing my private repositories.
I wish to deploy the files that are being updated on every commit to the ftp server.

I google'd out and found many scripts, but couldn't succeeded with any of them. The ftp server is an shared hosting server which is accessed by Filezilla in FTP explicit connection mode.

I don't want to use any third party online applications.

Please guide me a walk through to the solution.

I am trying to use this

But which key must be entered in the deployment key of Bitbucket account? Private or Public?

like image 518
Ck Maurya Avatar asked Aug 29 '14 09:08

Ck Maurya


2 Answers

You can use the new bitbucket tool, Pipelines! Configure a new pipeline file:

    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://server/public_html/

Before you commit, create the environment variables $ FTP_USERNAME and $ FTP_PASSWORD in settings -> environment variables.

For the push edit the source code and change the "init" to "push" and commit to replace the file on your shared server.

For more information watch this video: https://www.youtube.com/watch?v=8HZhHtZebdw

like image 70
Brian Avatar answered Nov 05 '22 21:11

Brian


This question is ages old. However, I am replying to the question in hopes of anyone else looking for a solution to this.

You can use the FTP Deployment PHP Script provided by BitBucket.

If you need FTPS explicit, in the functions.inc.php where you upload the above code, replace this line:

$conn_id = ftp_connect($ftp_host);

With the below:

// set up basic ssl connection
$conn_id = ftp_ssl_connect($ftp_host);

This should get you all set to use this script with explicit SSL-FTP connection instead of plain text FTP.

like image 37
user2318002 Avatar answered Nov 05 '22 21:11

user2318002