This doesn't sound good! (Like they say on the golf course, "Fooooooooooooooour!!!"
One way to do this is with turn-buckles. BUT, this method assumes that AT LEAST one of the 'ends' has the strength to hold back the other 'end'. If 'everything' is leaning, forget this option.
Now, do you have any idea why it's leaning if it's not the foundation?! How old is the garage? What do you have for bottom plates, sill, foundation, and 'timbers'? What condition are they in and what's the spacing? Did you follow professional plans or did you build this 'in your head'? Is just the back wall leaning (thus separating from the 2 sides), or are there more walls leaning?
If you were to reply and say the garage is new, the foundation is solid,flat concrete, and everything is level, then the only thing left is that the underlying structure is not properly built to support the weight of the roof. In other words, if you didn't double-stud the top plate onto which the roof sits, and/or you don't have headers over openings of 16" or more, then the roof is gonna put an awful lot of stress on your framework causing, among other things, leaning. Load is an important part of construction (just pressing the point for everyone reading this.)
So, if you have more, the post up. My best to ya and hope this helps.