The attack occurred sometime between 12:45 a.m. and 1:15 a.m. in the first block of Hancock Street, just west of the park, police said.
The victim saw that the suspect, possibly a homeless man, was preparing to spend the night in front of a home and asked him to sleep in a different spot, according to police.
The suspect then became aggressive with the victim, who said he was going to call police. But before he had the chance, the suspect knocked him to the ground, causing the head injuries.
The victim was taken to San Francisco General Hospital to be treated and has since been released, according to police.
The suspect fled and has not been found. He was described as a white man about 6 feet 2 inches tall and weighing about 200 pounds. He had curly brown hair and was last seen wearing a dark jacket, dark pants and a baseball hat, police said.
Anyone with information about the suspect is asked to call Sgt. Waaland at the Police Department's Mission Station at (415) 558-5485. People wishing to remain anonymous can call (415) 575-4444 or send a tip by text message to TIP411 with "SFPD" in the message.