Samuel Smith ,50, told the High Court in Edinburgh that an old friend called James Brown, 57, drove the vehicle which hit him at Broomknowes Road, Glasgow, on July 6.
A jury then heard that Mr Brown and two other men got out of the motor and struck Mr Smith on the back with a "bat or a cosh".
Mr Smith, whose address was given in court as being care of Police Scotland, then fell to the ground and two other individuals also started assaulting him.
He was also struck with a knife during the alleged incident.
The court heard Mr Smith claim he reckoned Mr Brown thought that he had "grassed him in for messing about with women".
The evidence emerged on the first day of the trial against Brown, a prisoner at Barlinnie jail, and Thomas McGovern, 46, of Bilsland Drive, Glasgow.
Both deny attempting to murder Mr Smith with other unnamed individuals in the Barlornock area of Glasgow earlier this year.
Mr Smith told prosecution lawyer Bill McVicar that a car struck him on Broomknowes Road. He said: "The driver was James Brown. He was a friend. I know him very well."
He told Mr McVicar that he fell to the ground after being struck by the car. However, he got back up and started walking towards Thomas McGovern who was standing close by. Mr Smith said that as he went to speak to Mr McGovern, he was assaulted by Mr Brown.
Prosecution lawyers allege that McGovern and Brown did, while acting with others, assault Mr Smith and cause a motor vehicle to mount a pavement.
The Crown alleges that they drove the car at him and knocked him to the ground before repeatedly striking Mr Smith on the head and body with pieces of wood and knives.
The prosecution also alleges that the two men also repeatedly punched, kicked and jumped on Mr Smith's head and body to his severe injury, permanent disfigurement and to the danger of his life.
Lawyers acting for Brown have lodged a special defence which states that at the time of the alleged incident, he was at home.
The trial before judge Lord Stewart continues.