0

I want to start using git and github but I am very confused I have already a website online but I want to add more changes. The problem is I don't know how to start using git. Do I take a copy localy then clone it to github repository but what about the server how can I upload chages automatically to it ?

Thanks

nina debb
  • 39
  • 4
  • 1
    I would recommend that you start by working through a tutorial, perhaps one offered by GitHub directly, and then coming back here with a more focused question. – Tim Biegeleisen May 28 '17 at 14:36
  • 1
    https://git-scm.com/book/en/v2 – Suraj Rao May 28 '17 at 14:36
  • Possible duplicate of [How do I backup my project with git?](https://stackoverflow.com/questions/44199658/how-do-i-backup-my-project-with-git) – Adharsh M May 28 '17 at 14:37

1 Answers1

0

You can do a lot of things. For example you can clone the project in your website and just pull (from there) your updated. This allow you to code in you machine and to update just connecting to your host.

There are some pros and cons in this solution. To do this automatically you can do two thigs:

  • write a script that automatically connect via ssh and pull code from github
  • add this script as git-hook

Git hooks are scripts stored inside .git/hooks folder. Each script handle some git hevent. So, .. you can handle post-commit event and push on remote every time you want. If you dont really want to update every single commit, .. keep the script for every deploy.

CD (Continuous Deploy) is a big argument. There are books about it. For now, just start with a bash script.

sensorario
  • 20,262
  • 30
  • 97
  • 159