while running this command I get this error and I am unable to understand and solve this
git push -u origin --all
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Hi @Jazib Khan and welcome to the community!
There are different possible causes for this error.
1. One possibility is that you don't have access to the repo.
2. Have you already set up SSH keys? If so, where did you add the public SSH key?
In case the public key was added to your account's settings and you have at least write access to the repo, then this is not an issue. In case the public key has been added as an Access key to a project or repo, these types of keys provide read-only access.
3. If the public key has been added to your account, then the private SSH key may not be offered during the git push operation.
I would suggest creating a file named config in your ~/.ssh folder and adding the following lines (if the file exists, just add the following content)
Host bitbucket.org
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
where ~/.ssh/id_rsa replace with the path and name of the private SSH key, whose public key you have uploaded to Bitbucket.
This will ensure that the correct SSH key is used when connecting to Bitbucket.
Please feel free to let me know how it goes and if you need further assistance.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.