Different makes of stepper motor use different pinouts. So you need to find the pairs. With the motor disconnected, spin the motor shaft to see how easy it is, then short two wires together and try spinning it again. If it is harder to spin, you have found a pair. Otherwise try shorting a different pair of wires.
Once you have found the pairs, wire them as above. In the above diagram, red and blue form a pair, and green and black form the other pair.
Once you have found the pairs, wire them as above. In the above diagram, red and blue form a pair, and green and black form the other pair.