20

I have private repo in github, and use it as a packages in my project. in pubspec.yaml i write it like these.

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

but then the error is "Could not find a file named "pubspec.yaml" in my github_repo"

I have added ssh in my account, and trying to configuring machine user in github. Then I tried to change it to normal https link, and no errors. but when I tried build on ci/cd in bitrise and get error.

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

But still can't figure it out how to solve this issue.

nhuluseda
  • 637
  • 3
  • 8
  • 19
  • I would like to ask how did you create the package? Was it with ```--template=package```, or is it a simple project? – Kaya Ryuuna Nov 25 '21 at 21:57

2 Answers2

26

Use the url line like this:

dependencies:
  my_project:
    git:
      url: ssh://git@gitserver/path/my_project.git
Richard Heap
  • 48,344
  • 9
  • 130
  • 112
2

Use this format and you don't need to add ssh in front

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

Please make sure you have configured the ssh-agent correctly.

Minion
  • 964
  • 14
  • 16