1 git-ftp.py: quick and efficient publishing of Git repositories over FTP
2 =======================================================================
7 Some web hosts only give you FTP access to the hosting space, but
8 you would still like to use Git to version the contents of your
9 directory. You could upload a full tarball of your website every
10 time you update but that's wasteful. git-ftp.py only uploads the
13 Requirements: [git-python 0.3.x](http://gitorious.org/git-python)
14 it can be installed with `easy_install gitpython`
16 We also [have a PPA](https://launchpad.net/~niklas-fiekas/+archive/ppa)
17 which you can install with `sudo add-apt-repository ppa:niklas-fiekas/ppa`
18 and then `sudo aptitude install git-ftp`.
20 Usage: `python git-ftp.py`
22 Note: If you run git-ftp.py for the first time on an existing project
23 you should upload to the hosting server a `git-rev.txt` file containing
24 SHA1 of the last commit which is already present there. Otherwise git-ftp.py
25 will upload and overwite the whole project which is not necessary.
27 Storing the FTP credentials
28 ---------------------------
30 You can place FTP credentials in `.git/ftpdata`, as such:
34 password=s00perP4zzw0rd
35 hostname=ftp.hostname.com
41 password=s00perP4zzw0rd
42 hostname=ftp.hostname.com
43 remotepath=/htdocs/staging
46 Each section corresponds to a git branch. FTP SSL support needs Python
49 Using a bare repository as a proxy
50 ----------------------------------
52 An additional script post-receive is provided to allow a central bare repository
53 to act as a proxy between the git users and the ftp server.
54 Pushing on branches that don't have an entry in the `ftpdata` configuration file
55 will have the default git behavior (`git-ftp.py` doesn't get called).
56 One advantage is that **users do not get to know the ftp credentials** (perfect for interns).
57 This is how the workflow looks like:
59 User1 --+ +--> FTP_staging
61 User2 -----> Git bare repository -----> FTP_master
63 User3 --+ +--> FTP_dev
65 This is how the setup looks like (One `ftpdata` configuration file, and a symlink to the update hook):
67 root@server:/path-to-repo/repo.git# ls
68 HEAD ORIG_HEAD branches config description ftpdata hooks info objects packed-refs refs
69 root@server:/path-to-repo/repo.git# ls hooks -l
71 lrwxr-xr-x 1 root root 29 Aug 19 17:17 post-receive -> /path-to-git-ftp/post-receive
77 Permission is hereby granted, free of charge, to any person
78 obtaining a copy of this software and associated documentation
79 files (the "Software"), to deal in the Software without
80 restriction, including without limitation the rights to use,
81 copy, modify, merge, publish, distribute, sublicense, and/or sell
82 copies of the Software, and to permit persons to whom the
83 Software is furnished to do so, subject to the following
86 The above copyright notice and this permission notice shall be
87 included in all copies or substantial portions of the Software.
89 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
91 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
92 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
93 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
94 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
95 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
96 OTHER DEALINGS IN THE SOFTWARE.