Detect repository existence correctly