Inspired by a result in T. H. Colding. (16). Acta. Math. 209(2) (2012), 229-263 [16] of Colding, the present paper studies the Green function $G$ on a non-parabolic $\operatorname {RCD}(0,\,N)$ space $(X,\, \mathsf {d},\, \mathfrak {m})$ for some finite $N>2$. Defining $\mathsf {b}_x=G(x,\, \cdot )^{\frac {1}{2-N}}$ for a point $x \in X$, which plays a role of a smoothed distance function from $x$, we prove that the gradient $|\nabla \mathsf {b}_x|$ has the canonical pointwise representative with the sharp upper bound in terms of the $N$-volume density $\nu _x=\lim _{r\to 0^+}\frac {\mathfrak {m} (B_r(x))}{r^N}$ of $\mathfrak {m}$ at $x$;\[ |\nabla \mathsf{b}_x|(y) \le \left(N(N-2)\nu_x\right)^{\frac{1}{N-2}}, \quad \text{for any }y \in X \setminus \{x\}. \] Moreover the rigidity is obtained, namely, the upper bound is attained at a point $y \in X \setminus \{x\}$ if and only if the space is isomorphic to the $N$-metric measure cone over an $\operatorname {RCD}(N-2,\, N-1)$ space. In the case when $x$ is an $N$-regular point, the rigidity states an isomorphism to the $N$-dimensional Euclidean space $\mathbb {R}^N$, thus, this extends the result of Colding to $\operatorname {RCD}(0,\,N)$ spaces. It is emphasized that the almost rigidities are also proved, which are new even in the smooth framework.