15

我在 github 中有私人仓库,并将其用作我的项目中的包。在 pubspec.yaml 我这样写。

dependencies:
  shared_preferences: ^0.4.3
  atomic_app_customer_musteat_id:
    git: git@github.com:organization/my_github_repo_ssh .git
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

但随后错误是“在我的 github_repo 中找不到名为“pubspec.yaml”的文件”

我在我的帐户中添加了 ssh,并尝试在 github 中配置机器用户。然后我尝试将其更改为正常的 https 链接,并且没有错误。但是当我尝试在 bitrise 中构建 ci/cd 并得到错误时。

pub get failed (69) -- attempting retry 5 in 16 seconds...
Git error. Command: git fetch
fatal: not a git repository 

但仍然无法弄清楚如何解决这个问题。

4

2 回答 2

20

使用这样的url行:

dependencies:
  my_project:
    git:
      url: ssh://git@gitserver/path/my_project.git
于 2019-02-07T02:23:12.137 回答
1

使用这种格式,前面不需要加ssh

dependencies:
<module_name>:
  git:
    url: git@github.com:<username>/Project.git

请确保您已正确配置 ssh-agent。

于 2021-09-14T08:41:44.493 回答