Expand the user home folder in the key_file argument of the git module

This fixes #7533 by using `expanduser` and `abspath`.

Let me know if you have any comment or suggestion, and please be gentle with me: this is my first contribution to this awesome piece of software :)