push from bitbucket repository to shared hosting f

2019-03-09 12:28发布

问题:

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?

回答1:

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



回答2:

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.