我卡在尝试启动Github actions工作流程的过程中。 Flutter项目有一个自定义包的依赖项。我在Github存储库中拥有这个自定义包。这是我在pubspec.yaml中设置此依赖项的方式:
xxxx_package:
git:
url: git@github.com:USER_NAME/xxxx_package.git
ref: develop
如果我运行flutter pub get命令,它会成功结束,我可以毫无问题地构建和执行应用程序。
但是,当我向 Github 发送推送并启动工作流程时,该过程以以下错误结束:
Running "flutter pub get" in Project-Flutter...
Git error. Command: `git clone --mirror git@github.com:xxx/xxxx_package.git /home/runner/.pub-cache/git/cache/xxxx_package-123456789`
stdout:
stderr: Cloning into bare repository '/home/runner/.pub-cache/git/cache/xxxx_package-123456789'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
这是我的操作工作流文件:
name: Check merge
on:
push:
branches: [ main, develop ]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
build:
name: flutter environment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.8.1'
- name: Install dependencies
run: flutter pub get
- run: flutter format --set-exit-if-changed .
- run: flutter analyze .
- run: flutter test
我已经配置了自定义软件包仓库,使其与ssh协议一起工作。 更新02/17/2022 我尝试了@GuiFalourd的建议,但不起作用。
我已经向两个仓库(主项目和私有仓库)添加了两个密钥(对于两个仓库都相同)。
- KNOWN_HOSTS - SSH_PRIVATE_KEY -> 这是内容 -----BEGIN RSA PRIVATE KEY----- ssh-ed25519 "SSH_KEY" -----END RSA PRIVATE KEY-----
但是这是输出:
IO : Finished git. Exit code 128.
| Nothing output on stdout.
| stderr:
| | Cloning into bare repository '/home/runner/.pub-cache/git/cache/xxxx_package-363daa26604baf2e3bfeae08af7d9c7050760631'...
| | Warning: Permanently added the ECDSA host key for IP address 'x.x.x.x' to the list of known hosts.
| | Load key "/home/runner/.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.
package
仓库是私有的吗? - ASAD HAMEED