I have a development server for my php project. The project directory is /var/www/html and i am planning to incorporating git for this development server.
I have created a git user and added my local pc's public key to server's .ssh/authorized key location.
My question is that where should i initialize the repository?
Best How To :
Git is a distributed version control system and as such there is no thing like THE repository, as each sandbox has his own repository.
That being said, most people initialise some repository first, and then clone that to the other machines. In many cases this is github or bitbucket.
In your case I would recommend initializing the repository on the server as you probably want to push your updates to there, and more importantly, you have already setup your ssh key there.
So the workflow should be something like
on the server:
$ cd /var/www/html
$ git init
on the development machine:
$ cd workdir
$ git clone [email protected]:/var/www/html
This should setup your sandbox, with a remote link called 'origin' to the repo on the server.
When updating you can then (after committing of course)
$ git push
to push the changes to the server.
Note: while this is a practical way to do this, it is not necessarily the best way. Keep looking critical at your practices and read up on alternative workflows.