Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use ssh to fetch private repos #67

Open
xoac opened this issue Oct 18, 2023 · 0 comments · May be fixed by #78
Open

Can't use ssh to fetch private repos #67

xoac opened this issue Oct 18, 2023 · 0 comments · May be fixed by #78
Labels
bug Something isn't working

Comments

@xoac
Copy link

xoac commented Oct 18, 2023

Describe the bug
When you use ssh://git@github.com/org/repo.git inside Cargo.toml to fetch private dependence I got error.

Error: -18 12:35:18 [ERROR] failed to fetch crates:     Updating crates.io index
    Updating git repository `ssh://git@github.com/org/repo.git`
error: cannot run ssh: No such file or directory
fatal: unable to fork
error: failed to get `my-dependency` as a dependency of package `my-package v0.1.0 (/github/workspace)`

Caused by:
  failed to load source for dependency `my-dependency`

Caused by:
  Unable to update ssh://git@github.com/org/repo.git?branch=feat/healtcheck-interface#cc73f02e

Caused by:
  failed to clone into: /usr/local/cargo/git/db/(...)
  
Caused by:
  process didn't exit successfully: `git fetch --tags --force --update-head-ok 'ssh://git@github.com/org/repo.git' '+refs/heads/*:refs/remotes/origin/*' '+HEAD:refs/remotes/origin/HEAD'` (exit status: 128)

job is defined below:

jobs:
  cargo-deny:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        checks:
          - advisories
          - bans licenses sources

    # Prevent sudden announcement of a new advisory from failing ci:
    continue-on-error: ${{ matrix.checks == 'advisories' }}

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.PAT }}
          submodules: "recursive"
      - name: Github SSH key setup
        uses: shimataro/ssh-key-action@v2
        with:
          key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"
          name: id_rsa
          known_hosts: github.com
      - uses: EmbarkStudios/cargo-deny-action@v1
        with:
          command: check ${{ matrix.checks }}

Expected behavior
Should just work out of the box or be possible to configure

Additional context:
To make cargo build works inside docker I need to add --mount=type=ssh.

for example:

RUN --mount=type=ssh cargo build --bins --release --workspace

Maybe the issue here is the same

@xoac xoac added the bug Something isn't working label Oct 18, 2023
@xoac xoac changed the title Can use ssh to fetch private repos Can't use ssh to fetch private repos Oct 18, 2023
@nagua nagua linked a pull request May 10, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant