Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I 'push' all the files in my git repository to my ftp server (live production)?

Tags:

git

ftp

I just started (barely) to somewhat understand and use git. I'm using github and cloud9 IDE.

I figured out how to save (commit and then push ?) files to the github repository...

question:

Is there a command that will upload (and overwrite) files from my git to my ftp server where my website is hosted?

I've checked this question, but I'm not sure I want a .git on my server (unless I can still run my site off it).

I've also checked this question, but I'm not sure I can install anything on my server.

Is this not as simple as I thought it would be?

Any help is much appreciated.

like image 909
d-_-b Avatar asked Dec 05 '25 08:12

d-_-b


2 Answers

Git is not an FTP client. But you could create a post-commit hook to do this. A git hook is a shell script which is executed with certain actions. You could use this to upload all of your source files to your FTP server when you do a commit. For more information about hooks, see:

http://www.kernel.org/pub/software/scm/git/docs/githooks.html

like image 105
Philipp Avatar answered Dec 07 '25 21:12

Philipp


If you are working on the commandline - use lftp to ftp your files to your host. lftp is highly scriptable and will allow you to add it to a post-commit hook if you so desire.

If you are using a gui - you can try filezilla or any number of other ftp clients to move your files to your server.

If this is a project that you want other to work on in the future, you can consider learning capistrano for automatic deployments and ease of releases.

like image 32
Michael Avatar answered Dec 07 '25 21:12

Michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!