The distance between the points $A$ and $B$ is $\sqrt{5}.$ If $A = (a,-1)$ and $B = (2,2a-1),$ then find the sum of all possible values of $a.$

The distance between $A$ and $B$ is $\sqrt{(a - 2)^2 + (-1 - (2a - 1))^2} = \sqrt{(a - 2)^2 + (-2a)^2}$. Squaring both sides, we get

\[(a - 2)^2 + 4a^2 = 5.\]This simplifies to $5a^2 - 4a - 1 = 0.$ Note that $5a^2 - 4a - 1 = (5a + 1)(a - 1),$ so the possible values of $a$ are $1$ and $-\frac{1}{5}.$

Therefore, the sum of all possible values of $a$ is $1 + \left( -\frac{1}{5} \right) = \boxed{\frac{4}{5}}.$

To find the distance between two points $A$ and $B$ in the Cartesian plane, we can use the distance formula:

$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.$$

In this case, $A = (a, -1)$ and $B = (2, 2a - 1),$ so we have:

$$d = \sqrt{(2 - a)^2 + (2a - 1 + 1)^2}.$$

Simplifying:

$$d = \sqrt{(2 - a)^2 + (2a)^2}.$$

We are given that $d = \sqrt{5},$ so we can write:

$$\sqrt{5} = \sqrt{(2 - a)^2 + (2a)^2}.$$

Squaring both sides, we get:

$$5 = (2 - a)^2 + (2a)^2.$$

Expanding, we have:

$$5 = 4 - 4a + a^2 + 4a^2.$$

Combining like terms, we can write:

$$0 = 5a^2 - 4a - 1.$$

To find the possible values of $a,$ we can solve this quadratic equation. We can factor this as:

$$(a - 1)(5a + 1) = 0.$$

So either $a - 1 = 0$ or $5a + 1 = 0.$ These give us $a = 1$ and $a = -\frac{1}{5},$ respectively. Therefore, the sum of all possible values of $a$ is $1 + \left( -\frac{1}{5} \right) = \boxed{\frac{4}{5}}.$

We are given that the distance between points $A$ and $B$ is $\sqrt{5}.$ The distance between two points $(x_1, y_1)$ and $(x_2, y_2)$ in a coordinate plane is given by the formula $\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.$ Applying this formula to the given points $A = (a, -1)$ and $B = (2, 2a - 1),$ we have

\[\sqrt{(2 - a)^2 + (2a - 1 - (-1))^2} = \sqrt{5}.\]Squaring both sides, we get
\[(2 - a)^2 + (2a - 2)^2 = 5.\]Expanding, we get
\[a^2 - 12a + 24 = 0.\]Factoring the left-hand side, we get $(a - 6)(a - 4) = 0,$ so $a = 6$ or $a = 4.$ Therefore, the sum of all possible values of $a$ is $6 + 4 = \boxed{10}.$