如何在服务器上设置git以进行自动提交/推送?

I have a sever and there I have Joomla installed and I wanted to setup git for this server. when a file is changed on this joomla setup it should automatically commit/push changes to the github repo.

is it possible with the help of php? if yes please let me know how?

For auto-commit, you want your system to watch file updates. See Making git auto-commit for more info.

If you want auto-push after the commit, you might want to look for post-commit git hooks : https://git-scm.com/book/it/v2/Customizing-Git-Git-Hooks