when is the force due to gravitation positive and when negative? i.e.
$$ F=+\frac{GMm}{r^2} ~~\mbox{or} ~~ F = -\frac{GMm}{r^2}. $$
we know that GPE $U=-\int F\cdot dr$, here $F$ will be $+GMm/r^2$ or $-GMm/r^2$ and if so why?
when is the force due to gravitation positive and when negative? i.e.
$$ F=+\frac{GMm}{r^2} ~~\mbox{or} ~~ F = -\frac{GMm}{r^2}. $$
we know that GPE $U=-\int F\cdot dr$, here $F$ will be $+GMm/r^2$ or $-GMm/r^2$ and if so why?
This depends on the convention you take with regard to the reference point for your potential. Typically, one uses the reference point of zero at infinity so the definite integral for potential becomes:
$$U(r) = - \int_\infty^r F(r') \cdot \mathop{dr'} $$
And in this case your potential, $U(r)$ will be negative and so will be the force. We can see that the force will be negative since:
$$ U \propto -1/r \implies -\nabla U \propto -1/r^2$$
So then we conclude that the force can be written as:
$$ F(r) = \frac{-GMm}{r^2} \hat r$$
It points inwards in the radial direction, which makes sense and is why this reference for potential is logical.
You could of course follow the same procedure based on any other reference point and you would find your dynamics would still follow in the same manner but what I have outlined above highlights the conventions that are usually followed.
This answer hopefully adds to @Qmechanics 's comment.
You have two point masses $M$ and $m$ separated by a distance $r$.
The magnitude (always a positive number) of the force of gravitational attraction between the two masses is $\dfrac{GMm}{r^2}$.
All the quantities in that fraction are positive.
If one wants to include the direction then it is usual to define a unit vector $\hat r$ whose direction is parallel to the line joining the two point masses.
Let the direction of the unit vector $\hat r$ be from mass $M$ towards mass $m$.
The gravitational attractive force $\vec F$ can then be written as $F\, \hat r$ where $F$ is the component of the force in the $\hat r$ direction.
The force on mass $m$ due to mass $M$ is $-\dfrac{GMm}{r^2} \hat r$ which is the same as $\dfrac{GMm}{r^2} (-\hat r)$
The direction of the force is from mass $m$ towards mass $M$.
The force on mass $M$ due to mass $m$ is $\dfrac{GMm}{r^2} \hat r$.
The direction of this force is from mass $M$ towards mass $m$.
If you want to evaluate the gravitational potential energy of this system of two masses then one way of doing this is to assume that mass $m$ starts at infinity and the potential energy with this separation is defines as being zero.
To evaluate the potential energy at a separation $r$ one has to evaluate $\displaystyle \int _\infty ^r \vec F \cdot d \vec r$
$\displaystyle \int _\infty ^r \vec F \cdot d \vec r =\int _\infty ^r \left (-\dfrac{GMm}{r^2} \hat r \right )\cdot \left ( dr\,\hat r \right )=\int _\infty ^r -\dfrac{GMm}{r^2} \, dr = -\dfrac{GMm}{r}$