1

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.

peace_love
  • 6,229
  • 11
  • 69
  • 157
  • 3
    Possible duplicate of [Git Server Like GitHub?](http://stackoverflow.com/questions/5507489/git-server-like-github) – Gimby Nov 01 '16 at 10:23

2 Answers2

3

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.

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
  • I’d like to add [GitLab](https://gitlab.com/) to the recommended services. It allows to share non-public repository (unlike GitHub) with several users (unlike BitBucket) for free. – Melebius Nov 01 '16 at 10:26
  • @Melebius This sounds interesting. I will have a look at it! – peace_love Nov 01 '16 at 10:29
  • GitHub and GitLab doesn't seem to be what I am looking for, because my repositories are not on my server but rather on some external server – peace_love Nov 01 '16 at 10:35
1

If your server supports git, it is no problem to clone your local repo to your remote server. As Sergio already answered, it is easier to use a hosted solution.

Sebastian
  • 11
  • 1
  • Does this answer actually add anything? I believe that Sergio's answer is sufficient. If that's the case please delete this answer. – Jonathan Mee Nov 01 '16 at 11:22