The only secret to (insert discipline) is repetition. That's it.
That piece of advice first struck home with me in the context of martial arts. As a child, I'd treated the idea of becoming a good fighter with mysticism. The right teacher, the right magical combination, and I would unlock my inner Bruce Lee (or, in my case, Sho Kosugi).
And I suppose that's correct to a point. Good teachers and good technique can do a lot for you. But with martials arts, you have to go further than just knowing what to do. You have to train your body to do it without needing to think about it. And to do that, you need repetition. Better yet, mindful repetition. That's really what a good martial arts teacher does for you. He or she teaches you how to be mindful of your own technique, so as you do the same things over and over and over again, you find ways to do them better.
Creativity is a default state. I wish people who don't think they're creative knew that. It's something we're born with, and it'll always be a part of who we are. Everyone's had a great idea for a song, movie, book, business, etc. And it was a good idea.
People become "artists" when they develop the ability to translate those good ideas into something tangible. And the dirty secret is that even the most famous artists out there are constantly falling short of the perfection in that initial idea. In this way, it can be painful to create. There's just so much possibility in an unrealized idea. It can be intoxicating.
But if you do it again and again and again, you get quicker at capturing those moments of creative insight. And you can use those bursts of creative energy to direct your study of technique.
Have a really hard time coming up with that melody? Look into the theory of how melody works. Find different ways of exploring melody. Focus in on making many one-off melodies you may never use. Do it until you can't help but do it. Then the next time you really need to do it, it'll take less effort, and you can put that effort into some other aspect of the composition.
Think of how you learned to read. First you had to sound every word out. Once you got a few of them committed to memory, you could decipher phrases, again requiring quite a lot of concentration. Then sentences and paragraphs. Then you could recognize structure and theme. Even at that level, you occasionally run into a word you don't recognize. So you zoom back in and use those same early tools to work it in with the rest. You don't have to learn all the fundamentals to go onto more advanced application. But you need to be willing to go back and learn them when they become necessary.