I am right now learning to work with git. I am still very confused, because usually I have for example my
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.