Reputation: 2216
I work on a git repository where we build an php community but i need to show it somewhere so I am looking for a way to automatic upload my files to a remote http server when i push to the repository.
Thanks /Victor
Upvotes: 0
Views: 789
Reputation: 50638
If there is no separate git repo on the second server, I would export files from archive:
git checkout-index -a -f --prefix=/target/path/
And then used sftp to synchronize with remote server:
#!/bin/bash
HOST="ftp.example.com"
USER="user"
PASS="pass"
LCD="/var/www/yourdir"
RCD="/www/"
lftp -c "
#debug;
open ftp://$USER:$PASS@$HOST;
lcd $LCD;
cd $RCD;
mirror --only-newer \
--reverse \
--verbose \
--exclude-glob somepattern ";
You may automate this process as a build script (e.g. Phing), our bind as a post commit git hook, like it has been mentioned before.
Upvotes: 1