如何使用 ftp git push?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5886363/
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
How to git push using ftp?
提问by nerkn
I want to upload (using only ftp) to my server only changes. I have a working git repository in my local. But I cant figure out any way to push using ftp.
我想上传(仅使用 ftp)到我的服务器只更改。我在本地有一个可用的 git 存储库。但我想不出任何使用 ftp 推送的方法。
I can use git push to send other hosting, beacuse it allow ssh, but this hosting only allows ftp.
我可以使用 git push 发送其他主机,因为它允许 ssh,但是这个主机只允许 ftp。
采纳答案by Philipp
You should be able to push to a FTP repository using
您应该能够使用推送到 FTP 存储库
git push ftp://host.net/path/to/repo.git/
回答by CharlesB
The git-ftpscript does exactly this:
在GIT-FTP脚本正是这样做的:
git-ftp by René Moser is a simple shell script for doing FTP the Git way. Use git-ftp.sh to upload only the Git tracked files to a FTP server, which have changed since the last upload. This saves time and bandwith. Even if you play with different branches, git-ftp.sh knows which files are different. No ordinary FTP client can do that.
René Moser 的 git-ftp 是一个简单的 shell 脚本,用于以 Git 方式执行 FTP。使用 git-ftp.sh 仅将 Git 跟踪的文件上传到 FTP 服务器,这些文件自上次上传以来已更改。这节省了时间和带宽。即使你玩不同的分支,git-ftp.sh 也知道哪些文件是不同的。没有普通的 FTP 客户端可以做到这一点。
回答by Banago
I've written a little PHP script that heps with that. It si called PHPloy and is tightly-coupled with Git to determine what which files where edited/added/deleted and uploads them accordingly. You put your FTP details in a deploy.ini file and run just a command to deploy:
我已经编写了一个小 PHP 脚本来解决这个问题。它被称为 PHPloy 并且与 Git 紧密耦合以确定哪些文件被编辑/添加/删除并相应地上传它们。您将 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:
您还可以一次部署到多台服务器。如果您配置了多台服务器,您可以选择部署到其中一台,如下所示:
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