I have two private repos in Bitbucket.
Inside repo two, I am fetching Repo one as dependency
"repositories": [
{
"type": "vcs",
"url": "git@bitbucket.org:myproject/repo-one.git"
}
],
"require": {
"myproject/repo-one": "dev-dev"
}
I have created auth.json in the project root.
{
"config": {
"http-basic": {
"bitbucket.org": {
"username": "accessTokenEmail",
"password": "accessToken"
}
},
"bitbucket-oauth": {
"bitbucket.org": {
"consumer-key": "myKey",
"consumer-secret": "mySecret"
}
},
"bearer": {
"bitbucket.org": "accessToken"
}
}
}
I tried all three methods mentioned above but I am not able to fetch the private repo one.
I tried the above method individually in auth.json.
If I have access to both the repos then I am able to access the repo as a dependency in composer and that is normal.
I am using composer version as below
Composer version: 2.6.3
Am I doing anything wrong in this?
Thanks.
Hi Amit,
I'm not very familiar with composer, but if what composer does is clone the repo, then I see you are using an SSH URL for the repo:
git@bitbucket.org:myproject/repo-one.git
and the credentials you provide in the auth.json file are for authentication over HTTPS.
If you use an SSH URL, then authentication will be done with the SSH keys available on the machine where the repo is cloned. If these SSH keys are associated with a Bitbucket user account, it is expected that the account will need to have access to the repos.
If you don't need the user's SSH keys on this machine, you can remove them (please take a backup before you do) and then
If you want to use HTTPS, you'll need to provide an HTTPS URL for the repo, like this
https://bitbucket.org/myproject/repo-one.git
I'm not sure if the structure of your auth.json is correct, this is best to double-check in a composer-specific forum. However, if you are using a repository access token, then the username should be the string x-token-auth instead of an email.
If you are using an app password, then the username needs to be the username of the Bitbucket account you generated the app password for and it can be found here if it is your own account https://bitbucket.org/account/settings/.
Kind regards,
Theodora
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.