简体   繁体   中英

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

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.

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

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.

As I mentioned in this answer , PHPloy is a great tool for sending your git changes to remote servers over FTP (you don't have to install anything on the server, which is great if you're on a shared web host). It works from the command line and is written in cross-platform PHP (and even detects changes in submodules).

https://github.com/banago/PHPloy

From your local development machine, you just type...

git commit ...
phploy -s stagingServer
phploy -s productionServer

Done!

(Disclaimer: after using it for a while I've now contributed some code patches and improvements, making it Windows-compatible.)

Whether using OSX, you can consider this GUI-based pretty convenient workflow (I also use for some WordPress stuff): http://eppz.eu/blog/push-git-to-ftp/

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM