One hard lesson I learned very early in life- Never run from a dog. Stand your ground. If you shove your arm hard all the way back into a dog's jaws, they can't get enough leverage to bite. I've stopped charging dogs dead in their tracks by telling them in a command voice "No! Bad dog!"
I've defended myself from an attacking dog by hitting him hard one the nose with a leather leash. Turned out the reason the dog came after me was the kids who owned it got their jollies by hiding while siccing their dog on other kids. (I was a teen at the time.)
Many dog owners tell me, when I first met their dog "Don't worry, he doesn't bite" I always respond "God gave all His creatures teeth for a reason".
I love dogs. Growing up, we had good sized GSDs and Saint Bernards, among others and they were good and true companions