We have a website that has all its PHP/HTML/JS/CSS/etc files stored in a Git repository.
We currently have 3 types of computers (or use cases) for the repository.
So currently we:
local: git push origin master
local: password: ********
local: ssh [email protected]
webserver: password: ********
webserver: cd ~/domain.com/
webserver: git pull origin master
So my question is: is there a way that from my local computer I can push straight to the web server?
ie.
local: git push origin master
local: password: ********
local: git push webserver master
local: password: ********
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 ~/domain.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/
Hope this helps!