Add this entry to your local .git/config
:
[remote "prod"]
url = amazon:/path/to/repo.git
fetch = +refs/heads/*:refs/remotes/amazon/*
For this example, you should have "amazon" as an entry in your ~/.ssh/hosts
file, like so:
Host amazon
Hostname <Actual host name of the server>
User <User to login as>
IdentityFile ~/.ssh/amazon-private-key
Then on the server:
mkdir -p /path/to/repo.git
cd /path/to/repo.git
git init --bare
git --bare update-server-info
git config core.bare false
git config core.worktree /path/to/actual/worktree
git config receive.denycurrentbranch ignore
cat > hooks/post-receive << EOF
#!/bin/sh
git checkout -f
EOF
chmod +x hooks/post-receive
You should then be able to do a git push prod master
from your local copy.
Additional resources: