That is it! You read right. If you are building small applications and don't need to prepare a super complex environment to deploy it and just want to keep the code on an updated server, you can set up a bare repository on your remote machine and "listen" changes on the master. So, with a push, you can always update the code on the remote machine.
Step 1: Create the repository that will listen to the pushes on GIT and the folder where the files will be stored
# create repository that will be listening the pushes
git init --bare bare_repository
# where the files will be stored
mkdir repository
step 2: Configure what must be done after each push
on the hooks folder, create a file named post-receive and configure what must be done.
#!/usr/bin/env bash
echo "checking out"
git --work-tree="<path_to_repository>" checkout -f
# install any new dependency...
echo "cd"
cd "<path_to_repository>"
echo "updating"
yarn # if we are using node for instance ....
step 3: non your developing environment create a "remote" to your server
git remote add deploy <username>@<remote_ip>:<path_to_bare_repository>
step 4: do the push / deploy :)
git push deploy HEAD:master
Done !!