The usual way into a first management job is to follow a previous manager to a new company where the manager is getting a promotion. The manager needs allies and can't trust people at the new company, so brings along one or two as managers.
Don't believe for a second that hard work or not screwing up will lead to a management position. If you think this you are not ready for a management position. For instance a lead dev I worked with screwed up a critical messaging system badly. He was already slated for a management job, so another dev was moved in to take the blame. This is what goes on in businesses as a matter of rule, not exception.
You need to make some deals and show a propensity for management 'skills' namely bending reality and perceptions towards your point of view while motivating people to do things they don't want to do.