Let $\mathbb{Q}(\sqrt{d})$ be a real quadratic field. If $d \equiv 2, 3$ modulo 4, then the ring of integers is $\mathbb{Z}[\sqrt{d}]$ and, if you want to compute the group of units, you need to find the minimal solution to Pell's equation $x^2-dy^2=\pm 1$. How to do this in terms of continued fractions is explained in all standard books.
However, there is also the case $d \equiv 1$ modulo 4. Then the ring of integers is $\mathbb{Z}[\frac{1+\sqrt{d}}{2}]$ and the equation becomes $x^2-dy^2=\pm 4$, again for $x, y$ integers. I have not found any reference about how to find a solution to this one. Of course, if you have a solution $(x_0, y_0)$ to the first one, then $(2x_0, 2y_0)$ is a solution of the second one, but it is never going to be the minimal one (I think) since it lies in $\mathbb{Z}[\sqrt{d}]$. For instance, if $d=5$, the minimal solution is $\frac{1+\sqrt{5}}{2}$.
So how does the method work in this case?