A well regulated militia, being necessary to the security of a free state, the right of the people to keep and bear arms, shall not be infringed.
— Ratified December 15, 1791
The very quick run-down they likely missed in your civics class:
YOU are the militia.
Security in a truly free state comes from the free exercise of the right to self preservation by its inhabitants.
In the (apparently) long-forgotten context of post-Revolution America, "militia" and "the people" could be used interchangeably based on the presupposition that every able-bodied adult male was expected to muster to the defense of his community and every family bore a subsequent duty to contribute to the sustenance of that effort.
Keep [v]: to retain possession of; to have as a supply.
To "bear" arms means the responsible use thereof wherever one may be. No, that doesn't mean locked away in a safe-in-a-safe with 17 locks and a biometric reader on the grip. It means readily available for use in provision for one's family and/or community and, perhaps more importantly, just defense from people who wish you harm.