Bash histroy autocomplete insetad of just scrolling up the history one at a time…

In your /home/username  directory create a new file (if one doesn’t already exists) called  “.inputrc”

If the file doesn’t already exist then create one and insert the below snippet. If one already exists then simply add to the bottom of the script the following snippet.

You will now need to restart bash,

Just run:

You should now be able to perform better autocomplete functionality by simply typing a few characters then pressing up 🙂

git pull as apache user to the site webroot

The end goal of this post is to be able to run a git pull and have the files being pulled down as the apache user. The command would be:

Fairly straight forward (just a few steps to walk through), the idea here is you want to clone the git repository as the apache user (in this case www-data) so the directory can be accessed as a std web folder/ web site.

First up we will need to install git on the server:

Next we need to allow apache to run a git pull

Add the following line (change to suit your apache user). Note it is the full path to the binary of git

Create a home directory for www-data (be root here)

Now register this new home dir against apache’s line in the ‘/etc/passwd’ file

Change this line:


To prevent the git pull request from wanting the git password you will want an ssh key (ensure you do not add a passphrase for the key) for apache to pass when ssh’ing as git:

You should be left with a key that you can grab and chuck into the authorized_keys on the server holding the master git. Grab the key:

Head over to your git sever and append (make sure it is all on one line):

Back to your production server now. If the git server you are pulling from does not run on a std ssh port, simply add a config file to the production server’s www-data/.ssh directory:

Add the following (altered to fit you settings)

That is it, your prod server should now be able to run git pull (after a clone of course).

Now, in the folder you want the git repository to live in just run (note the -H option being passed here, this just tells the program you are running in this case git that the home directory is that of www-data and not root, without it you will get a warning like: “warning: unable to access ‘/root/.config/git/attributes’: Permission denied”:

Unless already done, this will ask to add your git server to the known hosts file. Just type yes.

The output should be something along the lines of this:

Cool, all done. To run a pull simply modify the above command and run in the directory that contains the .git directory):

This logic can also be run in a php file now.. but i will chuck that in another post.

On screen or off screen.. nice jquery extension

On screen or off screen.. nice extension: