EXCLUSIVE

Rapper YG was shot early Friday morning at an L.A. recording studio ... TMZ has learned.

Law enforcement sources tell us, it happened at around 1:45 AM in Studio City. We're told someone shot YG 3 times in the hip.

Somehow the rapper was able to get in his car and someone from his group drove him to a nearby hospital.

Cops were called and found multiple shell casings and blood on the sidewalk. Police went to the hospital to interview YG but we are told he was "very uncooperative."

YG's rep says the injuries are not life threatening, and he's doing fine.