git Push & Automatic deployment

Sometimes it’s more convenient to just deploy the code to your staging server automatically when it’s being pushed to the remote repository. Although this is not recommended for Production at all, but it works well for the Staging server.

To set this up you just need to setup a hook on the remote repository for “post-receive”.

$ ssh to_remote_server
$ cd /path/to/git/repository
$ git config core.worktree /path/to/git/repository
$ git config receive.denycurrentbranch ignore
$ cat > .git/hooks/post-receive
git checkout -f

And finally make sure that the “post-receive” hook, has proper permissions to be executed.

chmod +x hooks/post-receive

Note: Make sure that the user is already part of the group who owns the directory which repository is located under.

Otherwise add it manually to the group.
In my case which the remote computer is a Mac, I have to execute the following command to add my username to the “wheel” group which owns the directory:

sudo dseditgroup -o edit -a my_username -t user wheel

References: This blog post helped me a lot.

In process of moving my blog

I’m in the process of moving my blog, I used to host wordpress on my server. I’m studying some other solutions and so far Jekyll has caught my eyes, and hosting on github pages, but it involves a bit of manual work to design the template and migrate my previous posts and comments. Till I completely migrate my new blog, I will be hosting the imported version of it here on

A lot of code snippets are broken and also images may not be loading, so please bear with me till we get up and running again.