Cloning private repo in the build

Hi guys,

We’ve spent couple of days trying to to clone from ‘another’ repo into circleci build job.

Setup:
_ main repo (Y)
|_ sub module (X - separate repo)

Config
X/.circleci/config.yml

  build:
    docker:
      - image: circleci/clojure:openjdk-8-tools-deps
    working_directory: ~/project
    steps:
      - checkout
      - attach_workspace:
          at: ~/project
      - add_ssh_keys:
          fingerprints:
            - "<Y - Project Settings - User Key (PREFERRED)>"
      - run:
          name: Clone Main repository
          command: >-
            GIT_SSH_COMMAND='ssh -vv -i ~/.ssh/id_rsa'
            git clone git@github.com:user/Y.git ~/Y

Error:

debug1: Authentication succeeded (publickey).
...
ERROR: Repository not found.
...
Transferred: sent 3664, received 2976 bytes, in 0.1 seconds
Bytes per second: sent 35415.8, received 28765.7
debug1: Exit status 1
fatal: Could not read from remote repository.

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

Exited with code exit status 128

Please help.

use access token instead of this
Setting → Developer Settings → personal access tokens → generate new token

git clone https://<Token>@github.com/<USERNAME>/<REPO_NAME>.git