【问题标题】:Avoid git-ftp upload if files already on server如果文件已经在服务器上,请避免 git-ftp 上传
【发布时间】:2012-10-23 16:34:31
【问题描述】:

假设我有一个应用程序的本地副本,我将其推送到 github,然后使用 git-ftp 将任何更改上传到我的服务器。

我会首先使用:

$ git ftp init -u <user> -p - ftp://host.example.com/public_html

这会将我所有的文件上传到服务器并使用git push 进行以后的上传,对吗?

但是如果我的服务器上已经有一个副本并且想要在本地设置它怎么办?我尝试下载我的应用程序文件,使用 git init,将所有内容推送到 github,然后当我尝试使用 git ftp push 时收到此错误:

fatal: Could not get last commit. Network down? Wrong URL? Use 'git ftp init' for the inital push., exiting...

然后我使用了git ftp init 命令,它成功了,但它重新上传了所有内容。

有没有什么方法可以设置它而无需重新上传所有内容并开始使用git ftp push

【问题讨论】:

    标签: git version-control github git-ftp


    【解决方案1】:

    来自git-ftp 的手册页:

    catchup
        Uploads current SHA1 to log, does not upload any files.
    
        This is useful if you used another FTP client to upload the
        files and now want to remember the SHA1.
    

    所以,如果您确定您的 git 存储库与 FTP 服务器同步,请在第一次运行 git ftp catchup 代替 git ftp init,它会将当前提交哈希上传到服务器但不会更改任何文件.在那之后,使用git ftp push 与它同步未来的提交。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-05
      • 1970-01-01
      • 2016-06-07
      • 1970-01-01
      • 2018-05-12
      • 2020-12-01
      相关资源
      最近更新 更多