Posts

Showing posts from November, 2015

create git hook to push code on server

Login to the server   ssh root@IP   sudo apt-get update sudo apt-get install apache2   Again, we should give ownership of the document root to the user we are operating as: sudo chown -R `whoami`:`id -gn` /var/www/html   We need to remember to install git on this machine as well: sudo apt-get install git Now, we can create a directory within our user's home directory to hold the repository. We can then move into that directory and initialize a bare repository. A bare repository does not have a working directory and is better for servers that you will not be working with much directly: m kdir ~/proj  cd ~/proj  git init --bare   Since this is a bare repository, there is no working directory and all of the files that are located in .git in a conventional setup are in the main directory itself. We need to create another git hook. This time, we are interested in the post-receive hook, which is run on the server receiving a git push . Open this