To get Glory as a companion you need to join the Railroad and finish proving yourself/finish the first quest.
Glory’s respect can be earned by hacking computers, hacking enemy robots and turning them friendly, getting in power armor, modding, being kind to synths and other kind people, humoring people, and killing BoS.
Glory’s dislikes are stealing, blowing up robots, aiding the BoS and the Institute, killing peaceful people, cannibalism, going against the Railroad, taking chems, and getting addicted.
She would have a quest to gain her absolute trust and her perk. The quest is to prove to her that you truly care about synths. To do this you and her need to track down a hunted synth. When the synth is found there is an altercation between the synth and a courser. The synth will say they will cooperate with the courser and be taken back to the Institute. Glory will try to convince them to fight back, to be free. You will then have the (very difficult) option of convincing the synth to fight back, which, with your’s and Glory’s help, will be successful. The other options are to either mercy kill the synth, which will cut Glory from being your companion, or to let them go, which will gain disdain from Glory but can convince her its for the best and you can keep her as a companion.