Refer to Using Git to Manage a Live Web Site.
sudo git init --bare --shared {website_name}.git && cd $_
sudo nano hooks/post-receive
#! /bin/sh
GIT_WORK_TREE=/var/www/{website_name}/html git checkout -qf --detach main
sudo chmod +x hooks/post-receive
git init
git add -A
git commit -m "Initial Commit"
git remote add live ssh://{user}@{webserver}/{path_to}/{website_name}.git
git push live +main:refs/heads/main
git push --set-upstream live main
git add .
git commit -a -m "some comment"
git push live
Creative Commons Attribution-ShareAlike 4.0 International License