Changing file line endings to LF in mixed unix/windows environments

Sometimes the developers of a project are working in different environments such as Linux, macOS and Windows. A big problem is the different handling of line endings. Windows uses CR/LF and all unix-based systems are using only LF. The code base should always use LF line endings to avoid problems.

So we must tell GIT that we want only LF line endings in our project (the following commands only work in a git repository folder):

git config core.eol lf
git config core.autocrlf input

To set this settings globally for all your git projects, add the --global paramater to the git config command.

You should also create a .gitattributes file in the repository folder and set the line endings for your file types:

# Ensure all project files using correct line endings
*.php     eol=lf
*.sh      eol=lf
*.xml     eol=lf
*.java    eol=lf

But this doesn’t affect files with incorrect line encodings already in your reporitory. To fix this, update your repository files with the following commands. Ensure you’ve no uncommited changes before using this.

git rm --cached -r .
git reset --hard
git add .
git commit -m "Normalize line endings"

Now all your files should have correct LF line endings and the changes can be pushed to your remote repository.

Change font size of NetBeans IDE controls

It’s a little bit confusing changing the font size of IDE controls and menus. The options dialog has only font size changes for the editor, not for the whole IDE. This is specially helpful on windows with scaled screen resolution on HiDPI displays.

The trick is to add an additional parameter to the VM options in the netbeans.conf configuration file. On Windows this is e.g. C:\Program Files\NetBeans 8.2\etc\netbeans.conf, on OS X /Applications/NetBeans/Netbeans

Add the parameter --font-size to the line starting with netbeans_default_options.

 netbeans_default_options="--font-size=14 -J-client -J-Xss2m -J-Xms32m"

Now the IDE has a font size of 14pt for the IDE.

Finder lost favorites after OS X update

After last update of OS X  El Capitan to version 10.11.2 the finder open dialog lost the favorite section in all applications. The finder itself displays it further.

To solve this problem you must delete the file


and restart finder with killall -KILL finder or restart the system.

Setting up ssh-agent for bash under windows

The bash shell for windows is a good extension to use git unter windows. But if you use ssh-based connections it is frustating to enter the passphrase for each connection.

Activating the ssh-agent solve this problem. Create the file .profile in your bash home directory and after starting the bash shell it also starts the ssh-agent and asks once for your ssh passphrase. The passphrase is cached in the ssh-agent during your bash session.

export SSH_AUTH_SOCK=/tmp/.ssh-socket
echo ;
echo Starting connection with ssh-agent...
ssh-add -l 2>&1 >/dev/null
if [ $? = 2 ]; then
  rm -f /tmp/.ssh-script /tmp/.ssh-agent-pid /tmp/.ssh-socket
  # Exit status 2 means couldn't connect to ssh-agent; start one now
  echo Creating new ssh-agent...
  ssh-agent -a $SSH_AUTH_SOCK > /tmp/.ssh-script
  . /tmp/.ssh-script
  echo $SSH_AGENT_PID > /tmp/.ssh-agent-pid
  echo ssh-agent set up successfully.
  ssh-add -l

Starting Rescue Mode in Ubuntu 11.10

It’s a little difficult to find the rescue mode in Ubuntu 11.10. Since 11.04 you can press the shift key in startup phase to show up the grub boot menu.

First step is changing the following line in /etc/default/grub




Activate the changes by running /usr/sbin/upgrade-grub.

Now you can boot up your system and can press the shift key to access the grub menu.

Another important thing is that the file systems are mounted read-only in rescue mode. If you want make changes to the file systems then you must first choose the remount option in the boot menu.