Create hook templates in Git

Hooks are scripts that you can use to run additional code when running Git commands. They are not stored in the repository so need to be set up on each computer individually.

You can create templates for your hooks that will be used whenever you create a new repository. To do this, put your scripts into the template folders on your local machine.

On Linux:


On Windows:

Program Files (x86)\Git\share\git-core\templates

When you next run git init you will then have these templates installed by default. Additionally, you can run git init in existing repositories to update the templates (it will not do any damage to the repo itself).

Symlink Git on cPanel

These days cPanel comes with Git. However, it is not available as a command by default but is instead hidden away in cPanel’s usual obscure location.

However, you can make it accessible using a symlink.

ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git

That will allow you to use the git command as normal. The version you get is likely to behind the current version of Git though.

Error resolving hostname on SSH tunnels

Lets say you are trying to create an SSH tunnel.

ssh -L 27017:somehost:27017

You may get the following error message.

ssh: Error resolving hostname \342\200\223L: nodename nor servname provided, or not known

This is caused by using the wrong kind of minus symbol. If you have copied and pasted the command from somewhere, this is probably the case. This is easy to fix – simply paste the command into your terminal, then go through it, remove the existing minus symbol and put a new – in.

Synergy disappeared from Ubuntu desktop

If you’re using Synergy for mouse and keyboard sharing, you may find that it suddenly disappears from Ubuntu. It will show up as installed in the Software Centre, but you won’t be able to remove or reinstall it, and there will be no icon on the unity bar.

If you try running it from the command line using the following command.


You may get an error similar to the following.

no configuration file found

The easiest way to solve this is to download the .deb package from the Synergy website, then open up a terminal and install it from there.

cd /home/your-name/Downloads
sudo dpkg -i synergy-1.4.10-Linux-x86_64.deb

This will then reinstall it and you should then be able to find the programme listed in the dash home.

Speed up really slow SSH connections

Sometimes, you might find that when you try and SSH into another server, it seems to hang, but then after around 30 seconds or so, will suddenly start working again. You can diagnose where it is stopping by using verbose mode.

ssh -vv user@example-server

If you find it is to do with GSS API, you can disable this in your SSH configuration.

cd ~/.ssh/
vim config

Add the following to it.

GSSAPIAuthentication no

This should then speed the login up.

Screen resolution drop on Ubuntu

If you find your screen resolution suddenly drops too 800×600 on Ubuntu 12.04, the following set of commands may help you resolve it. First, stop the graphical environment.

sudo service lightdm stop

Now remove all the Nvidia packages and reboot the system.

sudo apt-get purge nvidia*
sudo reboot

This will reset you to the default video driver. You now need to reinstall the Nvidia driver, which you can do by going to System settings > Additional Drivers and selecting the top option with the following name.

NVIDIA binary Xorg driver, kernal module and VPDAU library

Select this and click activate. Now reboot your system again and the Nvidia drivers will be re-installed and hopefully working again.

Gnome fails to start after switching Nvidia drivers on Ubuntu

If you’ve tried to switch to a different Nvidia graphics driver on Ubuntu and suddenly found that X / Gnome will no longer load and all you have is a command line, you can fix it by switching back to the original driver.

jockey-text -l
jockey-text -e xorg:nvidia_current

These commands will show you a list of drivers available, and then activate the standard Nvidia driver.