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.
I believe that the most elegant solution, especially for ci/cd pipelines and for teams working with Macos and linux machines, is using the .netrc
file for the autologin process.
#!/bin/bash
# Specify the credentials
MACHINE="gitlab.com" #gitlab.com or github.com
LOGIN="email@me.gr" #your email account on github/gitlab
PASSWORD="token"
# Create the .netrc file with the specified contents
cat <<EOF > ~/.netrc
machine $MACHINE
login $LOGIN
password $PASSWORD
EOF
# Set permissions to ensure only the user can read and write the file
chmod 600 ~/.netrc
Then on your pubspec.yaml
just reference the package with https
dependencies:
my_package:
git:
url: https://gitlab.com/team/my_package.git
ref: 'myref'