When was Mike willing to share his secret with ANYBODY? Before Jessica, the only people who knew were Harvey, Donna and those who already knew him(Jenny, Trevor and possibly his grandmother). We don't really know the exact nature of what Mike told the kid that was wrongfully convicted.
Also, he didn't just SUDDENLY decide not to tell Rachel. He wanted to tell her but Harvey forbade him from doing so. It makes sense that he would put his loyalty to Harvey above everything else, especially after Donna explained how he put himself on the line.