Could not read from remote repository

I was using danger-swift package in my repo and now I cannot use it anymore because this error:

Fetching https://github.com/shibapm/Komondor.git
warning: skipping cache due to an error: Failed to clone repository https://github.com/shibapm/Komondor.git:
    Cloning into bare repository '/Users/distiller/Library/Caches/org.swift.swiftpm/repositories/Komondor-b86bda7d'...
    Load key "/Users/distiller/.ssh/id_rsa": invalid format
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.
error: Failed to clone repository https://github.com/shibapm/Komondor.git:
    Cloning into bare repository '/Users/distiller/project/Packages/DangerDependencies/.build/repositories/Komondor-b86bda7d'...
    Load key "/Users/distiller/.ssh/id_rsa": invalid format
git@github.com: Permission denied (publickey).
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 1

Why do I need ssh key for public repositories? my project is in bitbucket and I dont want to create a ssh key in GitHub to use the package , before was working without add anything

Can you post the git command you are using.

I have no problems creating a local directory structure with the following command in a Windows CMD box.

git clone https://github.com/shibapm/Komondor.git

I don’t use any git command directly, this is spm package so when I run on circleci “swift run” it’s starting to fetch spm pakages and I get the error… before was working

If the error is being thrown from within a third-party package you may find a quicker response from their support forums. The only thing that I can put forward as a direction is to check that the distiller user is set up with the correct rights over the id_rsa file.

If you have the time can you create a simplified config.yml that results in the same error and post it here? This may allow someone to spot any issues with the general setup.

the problem is not with only one SPM package is for any SPM package that circleci try to fetch, I get the same ssh key error, how I said, this was working few months ago.
Im using a Package.swift and run it in circleci “swift build” Im not using SPM inside the project .

You need to post your config.yml so that people can see what maybe the issue.

version: 2.1

orbs:
macos: circleci/macos@2
shallow-checkout: datacamp/shallow-checkout@0.0.2

jobs:
run-danger:
macos:
xcode: <<pipeline.parameters.xcode_version>>
resource_class: macos.x86.medium.gen2
shell: /bin/bash --login -eo pipefail
working_directory: /Users/distiller/project
parameters:
dangerfile:
type: string
default: “”
dangerId:
type: string
default: “lint”
steps:
- checkout
- run:
working_directory: /Users/distiller/project/Packages/DangerDependencies
name: Installing Danger JS
command: npm install -g danger
- run:
working_directory: /Users/distiller/project/Packages/DangerDependencies
name: Compiling Danger
command: swift build
- run:
working_directory: /Users/distiller/project/
name: Danger CI
command: unset http_proxy; unset https_proxy;unset HTTP_PROXY; unset HTTPS_PROXY; DEBUG=* Packages/DangerDependencies/danger-swift ci -f -i << parameters.dangerId >> -d Packages/DangerDependencies/Dangerfile<< parameters.dangerfile >>.swift --verbose --fail-on-error

workflows:
test-workflow:
when: << pipeline.parameters.test-workflow >>
jobs:
- run-danger

VS Code Extension Version: 1.5.1

we dont have ssh key for GitHub configured and we dont want to have it, so, I was thinking the error could be because to much call cloning public repos (we have a lot of PRs daily), this could be a case?

That bit of information does not allow me to help resolve the issue, but it does make things clearer

The section of code throwing the errors is

name: Danger CI
    command: |
                       unset http_proxy; 
                       unset https_proxy;
                       unset HTTP_PROXY; 
                       unset HTTPS_PROXY; 
                       DEBUG=* 
                       Packages/DangerDependencies/danger-swift ci -f -i << parameters.dangerId >> -d 
                       Packages/DangerDependencies/Dangerfile<< parameters.dangerfile >>.swift --verbose --fail-on-error

Within your code base you have scripts under Packages/DangerDependencies which are what is throwing the errors as they are expecting to use ssh keys when accessing repos. You are going to have to look at the scripts to understand how the error is being caused as CircleCI’s direct interaction with the repo seems to be limited to just the checkout step that has been completed.

You may find that the scripts are using something like the toolset from the following site

https://danger.systems

But this is just a guess based on the naming used.