〜しかない
have no choice but to, all you can do is
Verb dictionary form + しかない
Sign up free to review this point on a spaced schedule.
At N5, しか〜ない was "only" with nouns. After a verb's dictionary form, しかない means "there's nothing to do but this": 電車が止まっているから、歩いて帰るしかない, "the trains aren't running, so I have no choice but to walk home".
It often comes with a sense of resignation or resolve: もう決まったことだから、やるしかない, "it's decided, so we just have to do it".
The polite form is しかありません. ほかない and よりほかない mean the same and are more formal.
Compare なければならない, which is obligation. しかない says the other options have run out.
Examples
電車が止まっているから、歩いて帰るしかない。
The trains aren't running, so I have no choice but to walk home.
もう決まったことだから、やるしかない。
It's already decided, so we just have to do it.
誰も手伝ってくれないなら、自分でやるしかありません。
If nobody will help, I'll just have to do it myself.
間に合わないなら、あきらめるしかない。
If we can't make it in time, we'll have to give up.
こうなったら、謝るしかないよ。
Now that it's come to this, all you can do is apologise.