How to Use Private Repo A in Repo B via Composer Without Requiring a Token Every Time? #137308
Replies: 3 comments
-
To use Repo A as a dependency in Repo B via Composer without requiring a GitHub token every time, you should try SSH authentication instead of HTTPS. Try this:
{
"repositories": [
{
"type": "vcs",
"url": "git@github.com:your-org/repo-a.git"
}
],
"require": {
"your-org/repo-a": "*"
}
}
ssh-keygen -t rsa -b 4096 -C "your_email@example.com" Add the public key (
eval "$(ssh-agent -s)" Add the SSH key to the agent: ssh-add ~/.ssh/id_rsa
git config --global url."git@github.com:".insteadOf "https://github.com/" Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I have two private repositories on GitHub:
I want to use Repo A as a dependency in Repo B using Composer. Currently, I am using the VCS method in Composer to include Repo A. However, every time I do this, I need to provide a GitHub token, which is not ideal for my use case.
Is there a way to set up these repositories so that if a user has access to Repo B, they can pull Repo A via Composer without needing to provide a token each time? Essentially, I want Repo A to be accessible internally or via some method that doesn't require extra authentication steps if the user already has access to Repo B.
Any suggestions or best practices for setting this up would be greatly appreciated!
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions