First thing, as I've often been told, git is not a deployment framework. That stated, as Paul Gear said, the easiest way is by using remotes.
First set up the remote on the machine that will push. The target should be a bare repository.
git remote add server1 ssh://[email protected]/home/username/gitrepo
then select your branch on the source machine:
git checkout featurebranch1
Finally, push the data to your remote:
git push server1 localbranch:destinationbranch
Or you can set your push to upstream and push to whatever the upstream branch is.
git config push.default upstream
As I mentioned previously the remote git must be a bare repository to accept push like this.
Maybe using a bare repository isn't good enough. In that case, on the receiving side, you might want to do something when you receive the data, like maybe checkout the files to a different directory (the repo must remain bare, remember). You can do that using a post-receive hook by creating a script file in /path/to/bare/repository/hooks/post-recieve like so:
#!/bin/sh
GIT_WORK_TREE=/var/www/html git checkout -f
chmod
it to executable. That will checkout the master
branch into the specified directory.