This is true for $G=GL(r)$, as shown by Quillen and Suslin.
For arbitrary $G$ there are counterexamples. Quite surprisingly, see even $G$-bundles over $\textrm{Spec }k$ may not be trivial. See the paper
M. S. Raghunathan
"Principal bundles on affine space and bundles on the projective line",
Mathematische Annalen Volume 285, Number 2, 309-332

