Home > Software engineering >  How to solve problem of git cloning while running flutter pub get for a dependency
How to solve problem of git cloning while running flutter pub get for a dependency

Time:09-02

I am currently working on an old flutter project. I want to install the necessary dependencies so that i can start making changes. Now when i run the flutter pub get command, i get a certain error which is not explaining how to solve it.

pub get failed (server unavailable) -- attempting retry 10 in 64 seconds... Git error. Command: git clone --mirror git://github.com/tekartik/platform.dart C:\src\flutter2\.pub-cache\git\cache\platform.dart-6f0f0462856ed9b1246d3c594e824b1b2d81f000 stdout: stderr: Cloning into bare repository 'C:\src\flutter2.pub-cache\git\cache\platform.dart-6f0f0462856ed9b1246d3c594e824b1b2d81f000'... fatal: unable to connect to github.com: github.com[0: 140.82.121.3]: errno=Unknown error

I think the point reached for downloading the dependency and it is not showing me where i can change from git:// to git@github

Below is a code snippet of the pubspec.yaml file where the dependency is to be installed

 tekartik_app_platform:
git:
  url: [email protected]:tekartik/app_flutter_utils.dart.git
  ref: null_safety
  path: app_platform
version: '>=0.1.0'

I am trying to get help on how to solve it because i only just got the code which is an old code and so am not sure where to go and make the fix.

Thank you alot in advance.

CodePudding user response:

Try changing it to:

git:
  url: https://github.com/tekartik/app_flutter_utils.dart
  path: app_platform
  ref: null_safety

More info on the packages can be found under: Dependencies on unpublished packages https://docs.flutter.dev/development/packages-and-plugins/using-packages

CodePudding user response:

I managed to find the solution. The ref value the project was using is null safety which still uses "git://" which is not being used by github anymore and so that is where the error is coming from.

So i changed to

  tekartik_app_platform:
git:
  url: [email protected]:tekartik/app_flutter_utils.dart.git
  ref: dart2_3
  path: app_platform
version: '>=0.1.0'
  • Related