views:

183

answers:

4

Hi, I would like to know if there is an easy way to push a GIT repository into production (on a FTP server) ? Thanks

A: 

If you are putting code into production, I recommend using an "installer" such as an RPM package to install your code. That way it will be version stamped and you will be able to leverage the installer package to support updates to the production code. Git is not really designed to support production installations, it is intended to track changes to the code itself.

In any event, with an .RPM (or EXE or whatever) built, you can just FTP it to the production system and install it like any other package.

Justin Ethier
Well, git can be leverage pretty well for this purpose in reality. Check out the tag and create post-checkout, post-merge etc hooks to handle any installation procedures needed. We used to use RPM packages but after moving to git it was simply overkill.
d11wtq
A: 

Add it as a remote, then you can push to it, however simply pushing code isn't enough, it needs to be merged with the working tree. The easiest way is to go the other way round, have a working tree on the server and fetch and merge into that.

d11wtq
+1  A: 

That's not what git is for, strictly speaking. However, if your source is something that doesn't need compiling or processing, say a website consisting entirely of html and javascript files and the like, you could have a clone of the repo on your webserver and use git pull from the server to keep it up-to-date. Note, I would config your webserver to hide the git directory and such. And that's just the beginning of the security concerns.

If you have any sort of compiling or processing, you should start looking at Ant, Maven, BuildR, SBT, etc.

sblundy
+2  A: 

Some tools recently added to the Git wiki:

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.

git-ftp by Edward Z. Yang is a simple script written in python for uploading files in a Git repository via FTP, only transferring new files and removing old files.

Tim Henigan
thats perfect, thanks
mnml