12

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.

I can use git push to send other hosting, beacuse it allow ssh, but this hosting only allows ftp.

nulltoken
  • 64,429
  • 20
  • 138
  • 130
nerkn
  • 1,867
  • 1
  • 20
  • 36
  • 2
    `git help push` indicates that Git supports FTP. What did you try so far? – Philipp May 04 '11 at 16:06
  • 1
    There is the Git FTP project here which provides a script for doing this, https://github.com/resmo/git-ftp . Either user that or take a look at the source code to figure it out? – planetjones May 04 '11 at 16:09
  • 1
    I'm confused with rsync, yes you are right, git supports FTP. Phillipp please leave answer. – nerkn May 04 '11 at 21:37

3 Answers3

9

The git-ftp script does exactly this:

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.

nonsensickle
  • 4,438
  • 2
  • 34
  • 61
CharlesB
  • 86,532
  • 28
  • 194
  • 218
6

You should be able to push to a FTP repository using

git push ftp://host.net/path/to/repo.git/
Philipp
  • 48,066
  • 12
  • 84
  • 109
  • 8
    Git-push version 1.7.12.4 manual specifically says: "Git supports ssh, git, http, and https protocols (in addition, ftp, and ftps **can be used for fetching** and rsync can be used for fetching and pushing, but these are inefficient and deprecated; do not use them)." That implies ftp is not meant for pushing and even fetching is depecated. – Juraj Jan 28 '13 at 13:50
4

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:

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

Banago
  • 1,350
  • 13
  • 22