All my friends cheered me on, saying 'hang in there!'

Literal

Friends [subject-が] all, do-your-best [quotative-と] encouraged [for me-くれた].

がんばれ is the imperative form of がんばる, used here not as a harsh command but as encouragement — one of the most common uses of the imperative in everyday Japanese. The quotative と packages it as the content of 勇気づける ('to give courage'). くれた marks the encouragement as a welcome favor.