This is a standard linear first order differential equation in the form y' - 2y = -t
You can use the integration factor e-2t to multiply through and obtain (using product rule in reverse):
d/dt (e-2ty) = te-2t which can be written as the integral, solving for y:
y - e2t(int(te-2tdt) + C) This equation is in every D Eqn text as a general equation with f(f) for t and the negative integral of the coefficient function (here -2) from in front of the y term)
integrating by parts and multiplying out:
y = (1/2)t + 1/4 + Ce2t
There are other ways to do this, but this is the explicit answer.
You can also find the homogeneous yh (equate right-hand side to 0 ) and then use the method of undetermined coefficients to determine the particular solution (yp). The solution y = yh + yp