How to clone a repository in a pipeline using GitLub CI? Error: "Host key verification failed"

My .gitlab-ci.yml:

stages:
    - test

stage_test:
    stage: test
    tags: 
        - test
    script: 
        - sudo git clone git@150.31.10.17:user/my_project.git

I am getting this error in my pipeline:

Cloning into 'my_project'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ERROR: Job failed: exit status 1

It downloads in the terminal without problems.

Also I tried to download like this:

git clone https://"user":"password"@"http://150.31.10.17/user/my_project.git";

And I am getting this error:

fatal: unable to access 'https://http://150.31.10.17/user/my_project.git/': Could not resolve host: http
ERROR: Job failed: exit status 1

Also I tried to download like this:

$ git config user.email
$ git config user.name
$ git config --global --unset http.proxy
$ git config --global --unset https.proxy  
`ssh-keyscan -t rsa 150.31.10.17 >> ~/.ssh/known_hosts`
git clone https://user:password@150.31.10.17/user/my_project.git

And I am getting this error:

fatal: unable to access 'https://150.31.10.17/user/my_project.git/': Failed to connect to 150.31.10.17 port 443: Connection timed out
`$ ls -la ~/.ssh/` 
total 16 `
drwx------ 2 gitlab-runner gitlab-runner 4096 Aug  8 19:03 .
drwxr-xr-x 4 gitlab-runner gitlab-runner 4096 Aug  8 17:07 ..
-rw-rw-r-- 1 gitlab-runner gitlab-runner 7358 Aug  8 19:03 known_hosts

Please tell me what am I doing wrong? Thank you!

Hi @alissia

Is the repo you are trying to clone also in your GitLab instance?