如何在 Linux 中将更改后的文件上传到网站?
我维护我女儿学校的网站。过去,我使用服务提供商的 webftp 界面通过他们基于 Web 的 GUI 进行就地编辑,这对于我通常需要进行的小编辑非常有效。他们最近出于安全原因禁用了 webftp,仅使用 ftp 作为修改网页和上传文档的方式。是的,我知道 FTP 本身不太安全,但那是另一回事了。
我已经使用 wget 来拉取该站点,并构建了一个 git 存储库来管理更改。当我进行更改时,我想将新文件和修改后的文件上传到网站。理想情况下,我只会上传新的和更改的文件,而不是整个网站。我的问题是我该怎么做?
我找到了 wput,它看起来很有前途,但它的文档并不清楚 wget 创建的哪个目录是我应该递归上传的目录,以及目标目录应该是什么。由于我们正在谈论一个实时网站,因此在我把事情做好之前我不想进行实验。
这似乎应该是一个具有众所周知的解决方案的常见用例,但我没有找到一个解决方案。我尝试在 Google 和 Stack Overflow 上搜索“上传更改的文件 ftp linux”等术语,但没有像我通常得到的那样弹出明确的答案。有些人建议使用 rsync,但目标位于服务提供商的系统上,因此这可能不起作用。我发现我的问题的许多变体都是以 Windows 为中心的,而且自从我在 Linux 上工作以来几乎没有什么帮助。
我想我可以设置一个目标虚拟机并进行实验,但这对于一个很容易回答的问题来说似乎有点过分,因此我向 Stack Overflow 求助。你有什么建议吗?
I maintain the website for my daughter's school. Historically I used our service provider's webftp interface to make edits in-place through their web-based GUI, which worked well for the small edits I typically need to make. They recently disabled webftp for security reasons, leaving ftp as the means to modify web pages and upload documents. Yes, I know FTP isn't very secure itself, but that's another story.
I have used wget to pull down the site and have built a git repository to manage changes. As I make changes, I want to upload the new and modified files to the website. Ideally I would only upload the new and changed files, not the entire site. My question is how do I do this?
I have found wput, which looks promising, but its documentation is not clear about which directory that wget created is the one I should recursively upload, and what the target directory should be. Since we are talking about a live site, I don't want to experiment until I get things right.
This seems like it should be a common use case with a well-known solution, but I have had little luck finding one. I have tried searches on Google and Stack Overflow with terms like "upload changed files ftp linux", but no clear answer pops up like I usually get. Some recommend rsync, but the target is on the service provider's system, so that might not work. Many variants of my question that I have found are Windows-centric and of little help since I work on Linux.
I suppose I could set up a target VM and experiment with that, but that seems excessive for what should be an easily answered question, hence my appeal to Stack Overflow. What do you recommend?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许这个答案对您有帮助:https://serverfault.com/questions/ 24622/how-to-use-rsync-over-ftp/24833#24833
它使用 lftp 的镜像功能,用于同步远程和本地目录树。
在维护站点时,我还经常使用 ftp 客户端中内置的 mc (midnight Commander)。
maybe this answer helps you : https://serverfault.com/questions/24622/how-to-use-rsync-over-ftp/24833#24833
It uses lftp's mirror function to sync up a remote and local directory tree.
I also used mc's (midnight commander) built in ftp client quite a lot when maintaining a site.
您应该将 git 与 git-ftp.一般来说,任何项目使用 VCS 都是一个好主意......
You should use git with git-ftp. It is generally a good idea to use a VCS by any project...