Assuming you already have a web server or normal server which is up and running.
Brief of the steps: [I will add details and the commands soon]
1. Create SSH keys on your server
2. Authorize them
3. Download your private key to your client machine
4. add the keys to client machine ssh
5.SSH connect to your server using username@host.com
6. it shouldn't have asked for any username and password now
7. install git on client and server machines
8. Login on the server machine using ssh, and create a bare git repo
9. in the hooks folder created after git init, create a post-receive hook with GIT_WORKING_TREE info
10. You are done with setting up a working git repo on the server, and you already have ssh connectivity with your client
11. On your client machine, go to a directory in which you want to clone/init the server repo
12. git clone, add, commit, push to the web server