How can I add a private package from GitHub with my user and password to my pubspec.yaml?

1,236

Finally, after test and test and test... found two good things:

First: We can use

dependencies:
  my_package:
    git: 
      url: https://my_user_name:[email protected]/my_account/my_package.git 
      ref: stable
      # ref: master or any other branch in your private package.

and with ref: we can select any branch by name.

Share:
1,236
abnerh69
Author by

abnerh69

Each day (almost), when I wake up, walk to my desk and sit down in from my Macbook Air... after few minutes, stand up and go to kitchen to serve my first cup of coffee. After that, the day looks pretty same... then lunch... then dinner... then reboot. Love my wife (28 years married), love my girls (20 and 23 each), and love my friends. But most of all, love my best friend and Design & Development teacher... God, Jehovah. Only four bits to make most complicated program ever written: ADN! Thanks.

Updated on December 18, 2022

Comments

  • abnerh69
    abnerh69 over 1 year

    My question is simple. I can clone a private git repository using

    git clone https://my_user_name:[email protected]/my_account/my_package.git
    

    now, How can I add a private package from GitHub with my user and password to my pubspec.yaml?

    dependencies:
      my_package:
        git: https://my_user_name:[email protected]/my_account/my_package.git 
    

    In my case, I am working with Flutter/Dart in IntelliJ IDEA. But assume the solution should work on any environment and other programming languages.

  • Himanshu
    Himanshu about 2 years
    what is my_account?
  • abnerh69
    abnerh69 almost 2 years
    my_account is the name in GitHub of your account (or bussiness account). Example: In GitHub ther a repo: flutter/plugins flutter is the account name. (in my answer is "my_account") plugins is the repository name. (in my answer is "my_package")