I would like some advice about how to setup Git for an existing live website on a production server (only hosting one site - no vHosts etc).
There are several examples of how to achieve this - but all refer to when you are starting a new project.
I'd like to replicate this scenario which describes how to setup a remote repository and create a post-update hook to copy files into the www directory upon checkout. This is the concept I can grasp (https://danielmiessler.com/study/git/#website)
However, I'm facing the scenario where there is live code on a webserver, I want to initialise Git on all the existing live files, and then develop on my local machine.
I'm sorry that I don't know enough about Git understand how to achieve the result described in Daniel's article from my starting position of having live code on a server in production.
My Config (CentOS 6/Nginx):
Git Repository (this should be in a separate location from www)
/home/username/repository/website.git
Post Update Hook File Location
/home/username/repository/website.git/hooks/post-update
Post Update Hook File Entry
GIT_WORK_TREE=/var/www/website git checkout -f
Website Directory
/var/www/website
I also have a ignore file
/var/www/website/.gitignore
Could someone kindly assist with Git commands. I can initialise /var/www/website/.git
(with an initial commit) but don't know how to then setup /user/username/repository/website.git
to work in the way described in the article.