Gitlab Merge Request: Could not find ref: dev in refs/heads, refs/remotes/upstream or refs/remotes/origin

To answer my own question:
GIT_DEPTH should be 0. This will deactivate shallow cloning, as it was described in the sonarcloud docs.