Nor*_*ert 11 git version-control github git-ftp
假设我有我的应用程序的本地副本,我将其推送到github,然后使用git-ftp将任何更改上传到我的服务器.
我会先用:
$ git ftp init -u <user> -p - ftp://host.example.com/public_html
Run Code Online (Sandbox Code Playgroud)
这会将我的所有文件上传到服务器并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...
Run Code Online (Sandbox Code Playgroud)
然后我使用了git ftp init命令它工作,但它重新上传了一切.
有没有办法设置它,而无需重新上传所有内容,只是开始使用git ftp push?
Jon*_*att 19
从手册页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.
Run Code Online (Sandbox Code Playgroud)
因此,如果您肯定您的git存储库与FTP服务器同步,则git ftp catchup代替git ftp init第一次运行,它会将当前提交哈希上传到服务器但不更改任何文件.在那之后,使用它git ftp push来同步未来的提交.