Police and school officials said the girl did not respond to the man and kept walking, and the man did not follow her.
The incident happened at about 8:30 a.m. as the girl was on her way to the Marina Middle School, located at 3500 Fillmore St.
San Francisco Unified School District spokeswoman Gentle Blythe said the girl was walking on Chestnut Street, about a block and a half away from the school.
According to Blythe, the girl told the counselor that the man rolled down his window and said, "Hey little girl, come get into my car."
Sgt. Lyn Tomioka described the suspect as a white man with "straggly, unkempt long hair."
The girl didn't know the man and ignored him and continued walking, Blythe said. She then reported the incident to her mother and a school counselor.
"We're very glad that she's safe, that she knew what to do to protect herself and that she reported it immediately," said Blythe.
Blythe said the school is preparing a letter to be sent to parents regarding the incident. Students at the school will also be notified, she said.
Police have filed a suspicious occurrence report and will follow up on the incident, Tomioka said.