Credit cards will help your credit score, contrary to popular belief. Banks want to feel safe giving you a credit line, so if you have other credit cards that you are paying on time, that's enough proof for them. The longer you've had a credit card history, the more they trust you.
So sign up for a credit card or two. One caveat: each time you apply for credit, it shows up on your credit report as an inquiry. If you have several inquiries, that means you are looking for credit and your score may temporarily drop a few points. So don't apply for several credit cards right before applying for a mortgage. However in the long run, your credit score will increase from you having credit cards.
Check your credit score for free via this link.