Add --git-dir option to git for out of source build. Fixes ROOT-5127.