Rust Project: Build and Push image to ECR

Hi, I am trying to build my rust project and push it against a repository in aws ecr using the orb aws-ecr: circleci/aws-ecr@8.1.2.

The problem is that in my cargo.toml file it references private dependencies, I have linked a machine user that I use to access private repositories of other projects but in this one I am getting an authentication error.

My config.yml:

version: 2.1

orbs:
  aws-ecr: circleci/aws-ecr@8.1.2


workflows:
  build_and_push_image:
    jobs:
      - aws-ecr/build-and-push-image:
          aws-access-key-id: AWS_ACCESS_KEY_ID_QA
          aws-cli-version: latest
          aws-secret-access-key: AWS_SECRET_ACCESS_KEY_QA
          #context: myContext
          create-repo: true
          dockerfile: Dockerfile
          executor: aws-ecr/default
          no-output-timeout: 5m
          path: .
          platform: linux/amd64
          public-registry: false
          push-image: true
          region: us-east-1
          registry-id: AWS_ACCOUNT_ID_QA
          repo: repo-name
          repo-scan-on-push: true
          tag: 'latest,myECRRepoTag'

My cargo.toml:

# Enable the "resolver" feature

cargo-features = ["resolver"]

[profile.release]

codegen-units = 1

debug = true

lto = true

[net]

git-fetch-with-cli = true

[toolchain]

channel = "nightly"

[url "ssh://git@github.com/"]

pushInsteadOf = "https://github.com/"

pushInsteadOf = "git://github.com/"

[package]

name = "project-name"

version = "1.1.0"

authors = ["Someone <someone@somebody.com>"]

edition = "2018"

[dependencies]

xxx-xxx = "1.2"

yyy-yyy = "1.1"

private_dependency_1 = { git = "ssh://github.com/org/private_dependency_1", tag = "1" }

private_dependency_2 = { git = "ssh://github.com/org/private_dependency_2", tag = "1" }

In the Dockerfile I’m running this for authentication RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts

And this is the error that I have, please help and thank you in advance.

I think I need to run something like git config --global url."git@github.com:".insteadOf “git://github.com/”, that’s why I added the section [url “ssh://git@github.com/”] in the cargo.toml file, however I seem to be having problems with that as well.