Decode bytes before using os.path.join

Otherwise it will raise TypeError when trying to join str() and bytes() instance 
in python-3.3.

Fixes #654
Closes #655
Do not use .strip(), add two check git has
Merge branch 'fix-git_directory' into HEAD