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 Exluding certain files from uploading
50 -------------------------------------
52 Similarly to `.gitignore` you can specify files which you do not wish to upload.
53 The default file with ignore patterns is `.gitftpignore` in project root directory,
54 however you can specify your own for every branch in .git/ftpdata:
58 gitftpignore=.my_gitftpignore
60 Used syntax is same as .gitignore's with the exception of overriding patterns,
61 eg. `**!**some/pattern`, which is not supported
62 Negations within patterns works as expected.
64 Using a bare repository as a proxy
65 ----------------------------------
67 An additional script post-receive is provided to allow a central bare repository
68 to act as a proxy between the git users and the ftp server.
69 Pushing on branches that don't have an entry in the `ftpdata` configuration file
70 will have the default git behavior (`git-ftp.py` doesn't get called).
71 One advantage is that **users do not get to know the ftp credentials** (perfect for interns).
72 This is how the workflow looks like:
74 User1 --+ +--> FTP_staging
76 User2 -----> Git bare repository -----> FTP_master
78 User3 --+ +--> FTP_dev
80 This is how the setup looks like (One `ftpdata` configuration file, and a symlink to the update hook):
82 root@server:/path-to-repo/repo.git# ls
83 HEAD ORIG_HEAD branches config description ftpdata hooks info objects packed-refs refs
84 root@server:/path-to-repo/repo.git# ls hooks -l
86 lrwxr-xr-x 1 root root 29 Aug 19 17:17 post-receive -> /path-to-git-ftp/post-receive
92 Permission is hereby granted, free of charge, to any person
93 obtaining a copy of this software and associated documentation
94 files (the "Software"), to deal in the Software without
95 restriction, including without limitation the rights to use,
96 copy, modify, merge, publish, distribute, sublicense, and/or sell
97 copies of the Software, and to permit persons to whom the
98 Software is furnished to do so, subject to the following
101 The above copyright notice and this permission notice shall be
102 included in all copies or substantial portions of the Software.
104 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
105 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
106 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
107 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
108 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
109 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
110 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
111 OTHER DEALINGS IN THE SOFTWARE.