… in a foreign occupied country. Aside from snide remarks is anybody honestly trying to propose that civilians with guns is a deterrent for for anything the government wants to do? You may as well be throwing rocks.
The hypothesis that guns are a deterrent has little to do with the citizenry fighting against the army or the police. It is about the risk of political assassination by a rogue individual every time a politician walks outside. If the leaders start to deviate significantly from the will of the median person, that risk goes up by a lot, hence the deterrent effect. Would Kim Jong Un still be around if every person was armed? Perhaps, but it'd be quite a bit less likely.
In some cases, it probably is a deterrent. It is hard to know for sure because there is no way to A/B test a country. I think that some people probably overestimate the degree to which it is a deterrent, but I think it would certainly be wrong to say that it is not a deterrent at all. In some situations it can probably be a very effective deterrent.