Add error check

Whether here is in git work tree