我在PhpStorm有一个项目.我按下upload to ftp根文件夹,所有文件都上传到服务器.然后我在这个项目上工作 - 让我们说修改一个文件.当我按下时upload to ftp,我看到所有文件都被重新上传 - 但是在上次上传后它们不会被修改.
我不想自动上传,也不想显式保存操作.设置覆盖了最新的文件中settings ? deployment ? options是不检查.
与部署同步不是一个解决方案,因为一个项目是巨大的蚂蚁比较每个文件的内容是一个完全浪费资源和时间.
如何只上传修改过的文件?
转到文件>设置,在项目设置上选择部署.添加FTP服务器并将其标记为默认值.单击"确定"关闭对话框窗口.
现在转到工具>部署>选项.选择您所看到的操作触发器: 自动将更改的文件上载到默认服务器
我希望它有所帮助!
首先,我不建议在需要安全性的项目中使用FTP。(通过 FTP 连接,密码和数据以非加密格式传输,因此很容易被窃取。唯一的例外是上传的文件(可能是包)经过签名,并且在对它们执行任何操作之前在服务器上检查数字签名。 Afaik。PHAR是默认的库,但是如果您将签名放入文件名中,则加密和签署任何 zip 文件相对容易。不要将数字签名与 md5 或 sha1 哈希混淆。)
通过 FTP 的简单项目,我使用git-ftp。
安装(通过Windows,但我认为它也适用于每个系统)
git bash
$ cd ~
$ git clone https://github.com/git-ftp/git-ftp git-ftp.git
$ cd git-ftp.git && chmod +x git-ftp
$ cp ~/git-ftp.git/git-ftp /bin/git-ftp
Run Code Online (Sandbox Code Playgroud)
配置
.git/config
[git-ftp "myscope"]
url = ftp.domain.com/subdir
user = user
password = pass
Run Code Online (Sandbox Code Playgroud)
初始化
git-ftp catchup -s myscope //by this the FTP and the local copy must be in perfect sync
Run Code Online (Sandbox Code Playgroud)
上传
git ftp push -s myscope
Run Code Online (Sandbox Code Playgroud)
您必须使用.git-ftp-ignore文件来定义您不想上传的内容。
我通常将 git-ftp 与 git merge 和 commit hook 一起使用。
.git/hooks/post-commit
.git/hooks/post-merge
#!/bin/sh
branch=`git rev-parse --abbrev-ref HEAD`
if [ $branch == "master" ]; then
git ftp push -s myscope
fi
Run Code Online (Sandbox Code Playgroud)
通过 master 分支的任何更改,git-ftp 都会自动上传。Ofc 我仅使用 master 分支进行发布,对于开发我使用另一个分支......
| 归档时间: |
|
| 查看次数: |
15562 次 |
| 最近记录: |