Game of Thrones” producers will shoot multiple versions of the ending of season eight to try to avoid leaks.

That’s according to HBO’s president of programming, who said last week:

“I know in ‘Game of Thrones,’ the ending, they’re going to shoot multiple versions so that nobody really know what happens,” HBO’s Casey Bloys said.

“You have to do that on a long show. Because when you’re shooting something, people know. So they’re going to shoot multiple versions so that there’s no real definitive answer until the end.”

So even “Game of Thrones” stars will have to watch the show’s final episode to see who survives the bloody blockbuster series.

Other hit shows — including AMC’s “Breaking Bad” and HBO’s “The Sopranos” — have kept their endings secret by shooting different endings.

Going back to 1980, “Dallas” producers shot many endings for a season four climax episode, with almost every major character filmed firing the gun that would resolve the cliffhanger of “Who Shot J.R.?” That “Who Done It” broadcast remains among the most-watched TV episodes ever.

Bloys, in a talk at Bethlehem’s Moravian College, discussed the challenge of writing a great ending.

“Finales are tough,” he said. “If you think about, ‘Six Feet Under,’ well that was a pretty good finale. But if you think about ‘Seinfeld,’ if you think about ‘The Sopranos,’ if you think about ‘Breaking Bad.’ Everybody has an opinion about how a show should end.”

About that “Sopranos” ending: Bloys said he still doesn’t know for sure what happened to Tony Soprano.

“The thing that was interesting about ‘The Sopranos’ was it did make you think,” he said. “In a way everybody got their own version of it. I think he was probably shot, but I don’t think David [Chase] has really told anybody what really happened in his mind.

“But I think that’s his point. It can be whatever you think it should be as a fan.”

Production on the six “Game of Thrones” episodes in the final season will begin in October and could continue until as late as August 2018, according to The Hollywood Reporter. That could mean the season might not start until 2019. HBO has not announced a date.

“Our production people are trying to figure out a timeline for the shoot and how much time the special effects take,” Bloys told The Hollywood Reporter.

Production is complicated by the fact the medieval fantasy drama is filmed on different continents. Past locations have included Malta, Morocco, Spain, Croatia, Iceland, Scotland and Northern Ireland.

“Game of Thrones” is gaining audiences — the season seven finale on Aug. 27 was the show’s most-watched episode. Season seven averaged more than 30 million viewers through live and delayed viewing, Bloys said.