git 从 bitbucket 存储库推送到共享托管 ftp 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25565246/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
push from bitbucket repository to shared hosting ftp server
提问by Ck Maurya
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.
我正在使用 Bitbucket 来管理我的私人存储库。
我希望在每次提交到 ftp 服务器时部署正在更新的文件。
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.
我用谷歌搜索并找到了许多脚本,但都没有成功。ftp 服务器是共享托管服务器,Filezilla 以 FTP 显式连接方式访问。
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?
但是在Bitbucket账户的部署密钥中必须输入哪个密钥?私人还是公共?
回答by Brian
You can use the new bitbucket tool, Pipelines! Configure a new pipeline file:
您可以使用新的 bitbucket 工具 Pipelines!配置一个新的管道文件:
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.
在提交之前,在设置 -> 环境变量中创建环境变量 $ FTP_USERNAME 和 $ FTP_PASSWORD。
For the push edit the source code and change the "init" to "push" and commit to replace the file on your shared server.
对于推送,编辑源代码并将“init”更改为“push”并提交以替换共享服务器上的文件。
For more information watch this video: https://www.youtube.com/watch?v=8HZhHtZebdw
有关更多信息,请观看此视频:https: //www.youtube.com/watch?v=8HZhHtZebdw
回答by user2318002
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 Scriptprovided by BitBucket.
您可以使用BitBucket 提供的 FTP 部署 PHP 脚本。
If you need FTPS explicit, in the functions.inc.php where you upload the above code, replace this line:
如果您需要显式 FTPS,请在上传上述代码的 functions.inc.php 中替换以下行:
$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.
这应该让您全部设置为将此脚本与显式 SSL-FTP 连接一起使用,而不是纯文本 FTP。