Git push to live server

Yes you can push directly to your webserver, but I wouldn’t recommend it since you should only push to repositories cloned with the –bare argument. I’d utilize the Git hook system to let the main repository automatically update the repo on the web server. Check out the post-update hook in:

http://git-scm.com/docs/githooks

This script could in turn login to the web server via SSH and do

cd ~/example.com/
git checkout master
git pull origin master

This way you only need to focus on pushing to the central server and don’t have to care about the web server, it will always be updated once a push has been made. If you can automate something, then automate it 🙂

I even found a nice article for you about logging in via SSH in a script (if you must use password, this is trivial if a ssh-key has been setup):

http://bash.cyberciti.biz/security/expect-ssh-login-script/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)