Lifting of principal G-bundles Let $k$ be an algebraically closed field.
We assume all schemes we consider are $k$-schemes.
Let $P \rightarrow X$ be a principal $G$-bundle, where $G$ is an algebraic group.
We assume $X$ is affine $(X := \text{Spec}(A))$.
Let $X  \rightarrow X' := \text{Spec}(A')$ be a thickening.
Note that thickening means $X \rightarrow X'$ is a closed immersion and its ideal sheaf is nilpotent.
Then, do we have a lifting of the principal bundle $P$ ?
I.e., We have the following cartesian diagram
$\require{AMScd}$
\begin{CD}
P @>>> P'\\
@VVV @VVV\\ X
@>>> X'
\end{CD}
, where $P' \rightarrow X'$ is also a principal $G$-bundle ?
Edit :
I originally came across this problem in the following question.
Let $Y$ be a $k$-scheme with a $G$-action and $P \rightarrow Y$ be a $G$-equivariant morphism ($P$ is defined as above).
Then, classify the liftings of $P \rightarrow Y$ to $P' \rightarrow Y$ s.t. they are also $G$-equivariant if a lifting $P' \rightarrow X'$ of a principal $G$-bundle $P \rightarrow X$ with respect $X \rightarrow X'$ exists.
 A: This follows from the infinitesimal lifting criterion for smoothness: An algebraic stack $\mathcal{X}$ locally of finite type is smooth if and only if for every nilpotent thickening $S \to S'$ of affine schemes, any map $S \to \mathcal{X}$ extends to $S'$. If $G$ is an algebraic group, its classifying space $BG := [pt/G]$ is an algebraic stack locally of finite type for the etale topology. This is so simply because $BG$ has a smooth cover by a point.
I'm not sure what the best reference is for the infinitesimal lifting criterion, but you can see one direction of the proof on page $36$ here.
A: What I wrote down before is wrong--in particular, I seemed to imply that one didn't need affineness hypotheses, but this is definitely not true (see this).
I think I am reinventing the wheel here (showing that I had a non-ideal grasp on the involved deformation theory before), and most of this is probably contained in leibnewtz reference, but since it makes sense to me now I thought I'd try to explain it.

Throughout the following, we make the following assumption:

Asssumption: Let $S$ be some affine base scheme, and $G$ an affine smooth group scheme over $S$.

NB: You can remove most of these assumptions, but for clarity let's ignore them for now.
For simplicity, for a morphism $X\to S$, let we will abusively write $G$ for $G_X$, since it will always be clear from context what is meant.
We then have the following cohomological classification of principal homogenous spaces (this is where the assumptions are tacitly used).

Theorem 1(cf. [Mil, Theorem 4.3]+[Gro, Theorem 11.7]): Let $X\to S$ be some morphism. Then, there are natural bijections
$$\mathbf{PHS}_G(X)\xrightarrow{\approx}H^1_\mathrm{fppf}(X,G)\xrightarrow{\approx}H^1_\mathrm{et}(X,G).$$

Here $\mathbf{PHS}(X)$ is the set of isomorphism classes of principal homogenous $G$-spaces $P\to X$, and the latter two hopefully are clear (they're non-abelian cohomology with values in the fppf/etale site: see [Poo, Chapter 6]).
Now, as is well-known (see Tag 04DY), if $p:X\to X'$ is a thickening (over $S$) then it induces an equivalence of etale sites $p_\ast: \mathrm{Sh}(X_\mathrm{et})\to \mathrm{Sh}(X'_\mathrm{et})$. In particular, one sees that one has an induced isomorphism
$$H^1(X_\mathrm{et},G)\xrightarrow{\approx}H^1_\mathrm{et}(X',p_\ast(G)).$$
Unfortunately, and this is where my original mistake was made, one does not, in general, have an isomorphism $p_\ast(G)\cong G$. Let us note though that there is a natural map $G\to p_\ast(G)$ which on some morphism $T'\to X'$ is the natural map $G(T')\to G(T)$ where I am writing $T:=T'\times_{X'}X$, but this is not an isomorphism.
To elucidate this, let us note that since etale morphisms $T'\to X'$ where $T'$ is affine is a basis for $X'_\mathrm{et}$ (and similarly for $X_\mathrm{et}$) we may assume without loss of generality that $T'=\mathrm{Spec}(A)$ and then thus that $T=\mathrm{Spec}(A/I)$ where $\widetilde{I}=(T'\to X')^\ast(\mathcal{I})$, and where $\mathcal{I}$ is the thickening ideal of $X\to X'$. Note then that our map $G\to p_\ast(G)$ is just the map which on $T'=\mathrm{Spec}(A)$ is given by $G(A)\to G(A/I)$ given by reducing modulo $A/I$. So, it's clear somehow that we have a short exact sequence
$$1\to \mathcal{K}\to G\to p_\ast(G)\to 1\qquad\qquad(1)$$
where $\mathcal{K}(A)=G(1+I)$, which is a subgroup of $G(A)$.
Now, here's the key point, if $\mathcal{I}$ is a square-zero ideal (which we can always reduce to by filterting our thickening by squarei-zero thickenings) then one actually has inverse isomorphisms
$$G(1+I)\xrightarrow{\log}\mathrm{Lie}(G)(I),\qquad \mathrm{Lie}(G)(I)\xrightarrow{\exp}G(1+I)$$
(which, if you want to work explicitly, is the obvious thing once you choose an embedding $G\hookrightarrow \mathrm{GL}_n$). In particular, we see that $\mathcal{K}$ is quasi-coherent.
Now, from (1) we have an exact sequence of non-abelian cohomology sets (see
$$1\to \mathcal{K}(X)\to G(X')\to p_\ast(G)(X')(=G(X))\to H^1_\mathrm{et}(X',\mathcal{K})\to H^1_\mathrm{et}(X',G)\to H^1_\mathrm{et}(X',p_\ast(G))(=H^1_\mathrm{et}(X,G))\to H^2_\mathrm{et}(X',\mathcal{K}).$$
(NB: we only get this last $H^2$ term since $\mathcal{K}$ is abelian). Now, combining this and Theorem 1 we see that we get an exact sequence of pointed sets
$$\mathbf{PHS}_G(X')\to\mathbf{PHS}_G(X)\to H^2_\mathrm{et}(X',\mathcal{K})(=H^2_\mathrm{Zar}(X',\mathcal{K})).$$
(see Tag 03P2 for this last equality). Aha, we see the point. Given any principal homogenous $G$-space $P\to X$ there is an associated deformation class $[P]\in H^2_\mathrm{et}(X',\mathcal{K})$ which has the property that $P\to X$ admits a lift to a principal homogenous space $P'\to X'$ if and only if this class $[P]$ vanishes. But, the point is that if $X$, and thus $X'$, is affine then the quasi-coherentness of $\mathcal{K}$ forces $H^2_\mathrm{Zar}(X',\mathcal{K})$ to vanish.
This is the classical reason that one needs affineness hypotheses when doing the infinitesimal lifting criterion as in leibnewtz answer.
I hope this clarifies things!
References:
[Gro] Grothendieck, A., 1966. Le groupe de Bauer III: exemples et compléments. IHES.
[Mil] Milne, J.S., 2016. Étale Cohomology (PMS-33), Volume 33. Princeton university press.
[Poo]Poonen, B., 2017. Rational points on varieties (Vol. 186). American Mathematical Soc..
