Is gitlab-ci-token user allowed to clone using ssh transport?

I need to clone using ssh another repository during the CI

I need to clone a repository on our gitlab server during a CI job, but this is not clear to me after reading the documentation what protocol are allowed.

  • repository is a dependency defined in a file package.json using ssh protocol (I can’t touch it)
  • https protocol is not allowed on the gitlab server
  • all my attempts to do a git clone during the CI jobs using ssh failed

I tried to clone the repository this way from a container launched from a CI job

git clone ssh://gitlab-ci-token:${CI_JOB_TOKEN}
Cloning into 'alc-build-utils'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The error message tends to confirm user / password is not supported, even after having set GIT_SSH_COMMAND="/usr/bin/ssh -vv -o PubkeyAuthentication=no".

How can I do ?

gitlab version: 15.1.0
gitlab-runner version: 15.1.0

Generate a new ssh keypair and add it as the deployment key to the target repository.