Ensure we're in the git directory before attempting to checkout