How can I use git online witout github?

I am right now learning to work with git. I am still very confused, because usually I have for example my

index.php

file on my server. I open it with my ftp client and make a change with my text editor. If I save it, I can just open www.mywebsite.com and I will see my changes online. It is simple and easy.

As far as I learned now, I can only make git Repositories local on my computer. So to make my file be online all tutorials tell me I need to use gitHub or something similar. But I just simply want to use my own server. It seems to be very complicated to connect my local directory now with my directory on my server.

My question is now, is it possible to use git directly on my own server (without a complicatied initialization?) Or do I need to use git hub, if I am not an expert.

If you are not an expect, then definitely the easiest way is to use hosted solution. Besides Github, there's also Bitbucket, GitLab and maybe others.

You can install a git server on your server machine, but you, as a novice, do not want to deal with it now.

Using hosted git, you will also learn about proper workflow. That is, no more changing files online. All changes go through git. You push to git server from your development machine and your server pulls those changes from git. Yes, you will spend some time and effort on implementing this, but that's how it must be done.