【问题标题】:How to access private repo packages in flutter using ssh?如何使用 ssh 在颤振中访问私有 repo 包?
【发布时间】:2019-07-01 02:21:53
【问题描述】:

我在 github 中有私有 repo,并在我的项目中将其用作包。在 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 

但还是不知道怎么解决这个问题。

【问题讨论】:

  • 我想问一下你是如何创建包的?是--template=package,还是一个简单的项目?

标签: git dart flutter bitrise


【解决方案1】:

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

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

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

【讨论】:

    【解决方案2】:

    像这样使用url 行:

    dependencies:
      my_project:
        git:
          url: ssh://git@gitserver/path/my_project.git
    

    【讨论】:

    • 谢谢!我错过了 ssh 部分,我认为 Flutter 应该将其添加到他们的文档中。
    • 关于命名提交等的更多细节here
    猜你喜欢
    • 2011-10-08
    • 2020-05-09
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2020-01-10
    • 2018-12-16
    • 2020-02-16
    • 2020-05-13
    相关资源
    最近更新 更多