我有一个Flutter项目,它正在从Github上的私有仓库中获取包,例如:
dependencies:
flutter:
sdk: flutter
my_package:
git:
url: git@github.com:username/my_package.git
ref: main
当我在本地计算机上运行
flutter pub get
时,一切正常,因为我通过ssh将计算机连接到GitHub,但是一旦我在GitHub上推送,我的GitHub actions 就无法获取包并显示以下信息:git@github.com: Permission denied (publickey)
。我理解错误消息,我想知道是否有更好的方法来解决这个问题并通过操作。
以下是GitHub操作脚本:name: Flutter
on: [pull_request, push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1.5.0
- name: Install Dependencies
run: flutter packages get
- name: Format
run: flutter format --set-exit-if-changed lib test
- name: Analyze
run: flutter analyze lib test
- name: Run tests
run: flutter test --no-pub --coverage --test-randomize-ordering-seed random