- Create a Bare Repo on Server
ssh kunal@domain.com
mkdir website.git
cd website.git
git init --bare
- Create a Hook to copy files from the bare git directory to the nginx/apache website directory
cd hooks
mv post-update.sample post-update
nano post-update
Update the "post-update" hook with following content:
git --work-tree=/var/www/html/domain.com/public_html --git-dir=/home/kunal/website.git checkout -g
- Initialize the local repo:
cd proj
git init
git add .
git commit -m "First commit"
- Push to Server
git remote add origin kunal@ipaddress:/home/kunal/website.git
git push origin master
If you are using SSH keys to login to the server, make sure "pageant" is running with the keys added to it.