detect repo first