push from bitbucket repository to shared hosting ftp server

偶尔善良 提交于 2019-12-03 05:11:10

问题


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.



来源:https://stackoverflow.com/questions/25565246/push-from-bitbucket-repository-to-shared-hosting-ftp-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!