repositories if configured are public. Thus such a check will by design fail.
@seb, @rafael please review. I tested this and it works.