Problem solved. For some reason, the SSH-URL-suffix for the repository is different from the HTTP-URL-suffix. After finding that out, it worked.
Edit:
The http-url stash gave me was user@server:7990/a/b/sandbox.git
, while the ssh-url stash gave me is user@server:7999/b/sandbox.git
(where a and b are of course placeholders).
As it was mentioned in the comments, that I should add this to my answer.