Who was Joseph’s father?

Here’s a question for all you Biblical literalists out there:
Who was Joseph’s father? (I mean the Joseph who took Mary to be his wife)

Could be Jacob (if you believe Matthew 1)
Could be Heli (if you believe Luke 3)

This presents a clear biblical contradiction.

Now… I’m sure that some of you will rush to Google any apologetic answer to explain away this, *shock horror*, biblical contradiction.

You’ll probably come across this dodgy explanation if you do:

Luke’s account is actually not talking about Joseph’s family history at all… it’s talking about Mary’s family history… but instead of mentioning Mary, Luke is following a Hebrew tradition when giving genealogies: not mentioning a woman, but replacing her with her husband.

Thing is… I reckon that’s a lie. And as far as I can tell, it came from Adam Clarke’s nineteenth century commentary on the Bible. He says:

As the Hebrews never permitted women to enter into their genealogical tables, whenever a family happened to end with a daughter, instead of naming her in the genealogy, they inserted her husband, as the son of him who was, in reality, but his father-in-law.

If you do want to use that common apologetic excuse… please justify it by showing evidence that it was, in fact, a Hebrew tradition. You could even throw some doubt on my strong sense that it’s a lie made up by Adam (or perhaps his bishop Pearce) by showing that anybody before the nineteenth century thought up such an excuse (earlier the better).

Otherwise, how do you explain this contradiction?

Oh, there is another alternative… you could opt to pretend that “Joseph” in Matthew’s account is actually Mary’s father… despite, you know, the text… the text that explicitly mentions Joseph as her husband.

Matthew 1:

15 And Eliud begat Eleazar; and Eleazar begat Matthan; and Matthan begat Jacob;
16 And Jacob begat Joseph the husband of Mary, of whom was born Jesus, who is called Christ.

Luke 3:

23 And Jesus himself began to be about thirty years of age, being (as was supposed) the son of Joseph, which was the son of Heli,