Let's say I have a local copy of my app and I push it to github and then use git-ftp to upload any changes to my server.
I would first use:
$ git ftp init -u <user> -p - ftp://host.example.com/public_html
which would upload all my files to the server and use git push
for future uploads, right?
But what if I already have a copy on my server and want to set it up locally? I tried downloading my app files, used git init
, pushed everything to github and then when I tried using git ftp push
I received this error:
fatal: Could not get last commit. Network down? Wrong URL? Use 'git ftp init' for the inital push., exiting...
Then I used the git ftp init
command and it worked, but it re-uploaded everything.
Is there any way to set this up without having to re-upload everything and just start using git ftp push
?
From the man page for 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.
So, if you're positive your git repository is in sync with the FTP server, run git ftp catchup
in place of git ftp init
the first time and it will upload the current commit hash to the server but not change any files. After that point, use git ftp push
to sync future commits with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With