简体   繁体   English

如何使用 ftp 推送 git?

[英]How to git push using ftp?

I want to upload (using only ftp) to my server only changes.我想上传(仅使用 ftp)到我的服务器,只有更改。 I have a working git repository in my local.我在本地有一个可用的 git 存储库。 But I cant figure out any way to push using ftp.但我想不出任何方法来推动使用 ftp。

I can use git push to send other hosting, beacuse it allow ssh, but this hosting only allows ftp.我可以使用 git 推送发送其他主机,因为它允许 ssh,但这个主机只允许 ftp。

The git-ftp script does exactly this: git-ftp脚本正是这样做的:

git-ftp by René Moser is a simple shell script for doing FTP the Git way. René Moser 的 git-ftp 是一个简单的 shell 脚本,用于执行 FTP Git 方式。 Use git-ftp.sh to upload only the Git tracked files to a FTP server, which have changed since the last upload.使用 git-ftp.sh 仅将 Git 跟踪文件上传到 FTP 服务器,该服务器自上次上传以来已更改。 This saves time and bandwith.这节省了时间和带宽。 Even if you play with different branches, git-ftp.sh knows which files are different.即使您使用不同的分支,git-ftp.sh 也知道哪些文件不同。 No ordinary FTP client can do that.没有普通的 FTP 客户端可以做到这一点。

You should be able to push to a FTP repository using您应该能够使用

git push ftp://host.net/path/to/repo.git/

I've written a little PHP script that heps with that.我写了一个小 PHP 脚本,对此很满意。 It si called PHPloy and is tightly-coupled with Git to determine what which files where edited/added/deleted and uploads them accordingly.它被称为 PHPloy 并与 Git 紧密耦合,以确定编辑/添加/删除哪些文件并相应地上传它们。 You put your FTP details in a deploy.ini file and run just a command to deploy:您将 FTP 详细信息放在 deploy.ini 文件中,然后运行一个命令进行部署:

phploy

You can also deploy to multiple servers at once.您还可以一次部署到多个服务器。 And if you have multiple servers configured, you can select to deploy to one of them like this:如果您配置了多台服务器,您可以 select 像这样部署到其中一台:

phploy --server staging

There is more that can be done – check it out on Github: https://github.com/banago/PHPloy还有更多可以做的——查看 Github: https://github.com/banago/PHPloy

you can check roll-out .你可以检查推出 Rollout has the following features. Rollout 具有以下功能。

Atomic Deployment原子部署

It downloads the changes of your code in separate folder, till it completes downloading of all the files.它将您的代码更改下载到单独的文件夹中,直到完成所有文件的下载。

releases\v1\ releases\v2\ releases\v3\ current -> release\v3\

Once all the files are downloaded.下载完所有文件后。 It makes that folder as active version of your website.它使该文件夹成为您网站的活动版本。 So its very transparent to user that nobody knew about any new versions/revisions.因此它对用户非常透明,没有人知道任何新版本/修订。

Included batteries随附电池

Version Check:版本检查:

It checks if the PHP Version on your hosting server matches your requirement.它会检查您的托管服务器上的 PHP 版本是否符合您的要求。 This is very important because Hosting servers doesn't inform you when they update PHP Versions on their servers.这非常重要,因为托管服务器在更新其服务器上的 PHP 版本时不会通知您。 You may have forgotten to keep your development machines to match the php versions.您可能忘记让您的开发机器与 php 版本相匹配。

So Why Should we check the version?那么我们为什么要检查版本呢?

Every versions of PHP includes new features, and depreciate lots of features and functions. PHP 的每个版本都包含新特性,并贬低了许多特性和功能。 For When your developed a website using PHP 5.3 and your hosting server has PHP 5.6.当您使用 PHP 5.3 开发网站并且您的托管服务器具有 PHP 5.6 时。 Chances are there the following features can break.以下功能可能会中断。

Here are the list of features/functions that are depreciated in the versions mentioned below.以下是在下面提到的版本中折旧的特性/功能列表。

  1. Features & Functions depreciated in PHP 5.5 PHP 5.5 中贬值的特性和功能
  2. Features & Functions depreciated in PHP 5.6 PHP 5.6 中贬值的特性和功能
  3. Features & Functions depreciated in PHP 7.0 PHP 7.0 中贬值的特性和功能

Extension Check扩展检查

rollout Analyse the code and pick out all the extensions used by your PHP codebase, and check if all those extensions are present on the server. rollout分析代码并挑选出 PHP 代码库使用的所有扩展,并检查服务器上是否存在所有这些扩展。 If they are not present, rollout will alert you to install the extension.如果它们不存在,rollout 将提醒您安装扩展。 By checking these you avoid the risk of breaking of your code since that particular extension is not present and eventually you tend to avoid the risk of hours of debugging to analyse what went wrong in the hosting server.通过检查这些,您可以避免代码中断的风险,因为该特定扩展不存在,并且最终您倾向于避免花费数小时调试来分析托管服务器中出现问题的风险。

Automatic Dependencies Installation自动依赖安装

Just add composer.json rollout will automatically install all the dependencies mentioned in composer.json只需添加composer.json推出将自动安装composer.json中提到的所有依赖项

PHP Linting: PHP 起绒:

rollout does automatic PHP Linting of the entire codebase looking for any errors. rollout对整个代码库进行自动 PHP Linting 以查找任何错误。 It would halt the installation, if rollout finds any php syntax error.如果 rollout 发现任何 php 语法错误,它将停止安装。 This again helps in breaking of code on the hosting server.这再次有助于破坏托管服务器上的代码。

Rollback is just a click away只需点击一下即可回滚

After you deploy your code on the hosting server.在托管服务器上部署代码之后。 If anything goes wrong, you can easily revert to previous version.如果出现任何问题,您可以轻松恢复到以前的版本。 Just at the click of a button.只需单击一个按钮。

Also rollout is completely free for open source projects or public repositories.对于开源项目或公共存储库,推出也是完全免费的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM