Obvious disclaimer: no technique will work for everyone. This is what has worked for me. (And I should by no means be taken as a model of self-motivation, so there’s that.)
What has helped me in the past, though, has been starting small. My usual pattern is to come up with an idea that is ridiculously large - the sort of thing that I could, in theory, create, but only if I worked consistently on it for several years - then get discouraged when there’s not much palpable progress. Starting out by making very small games - the kind you can produce in a few hours, or a weekend - helped me to get something actually finished, and knowing that you can produce something finished and playable is a big confidence boost. (Not to mention that finishing a game requires a different set of skills to starting one - it’s important to train both.)
It can also provide some motivation to take part in a game-jam, minicomp or similar small event: this gives you a deadline, and usually the expectation that you’ll have at least some audience at the end of it, and that they’ll be grading on a curve.
Change your work environment up. Invisible Parties has a bunch of coffee-shops and bars listed in the credits for a very good reason. People talk about reducing distractions, and that’s part of it, but honestly I could still waste time on Twitter or whatever in any of those places; but it helps for me to say that I’m in a place for a specific purpose.