Credited with - when we mention what someone has achieved... Credited to - when we associate one's achievement/success with a source/reason of something else...
Newton is credited with discovering the laws of motion. -- here we talk about what is achieved. Edison is credited with discovering the bulb -- here we talk about what is achieved. We had to credit much of our success to simple good luck. -- here we talk about the source of achievement.