So, I've been using composer to manage my git repos (on bitbucket) and now, out of the blue composer complains about me not having access to my repos :S
I haven't done anything in particular. But I went ahead and generated a new key using ssh-keygen
, copied the public key and added it to my bitbucket account.
So I tried sudo composer update
again, and it still complains:
Failed to update [email protected]:afflicto/event.git, package information from this repository may be outdated (Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch origin
)
What could be wrong?
I just pushed to one of my git repos, and it works fine. So it seems the SSH Key is setup correctly but Composer is doing something strange.
It seems that running composer update
as sudo
(i.e sudo composer update
) will not use your ssh keys... so I have to add my SSH keys to the root user I suppose? :\
As mentioned in this BitBucket thread:
By using
sudo ssh
will look forroot
's keys, not yours in/home/username/.ssh/
.
You probably shouldn't be running git with sudo.But if you really need to, generate some new keys under the
root
account and upload those to Bitbucket.
Or you can try sudo -E
, to preserve your environment, as mentioned in "Git SSH public key denied".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With