2

I configured the SSH based authentication as below

  • Created a public key on my UNIX server
  • Added the public key on my Bitbucket repository with reading and write privileges (also tried it at account level)
  • changed the URL from https to SSH at bitbucket and Unix server
  • verified the URL using and it is displaying SSH URL only

Then Tried to push, but I am getting the below error:

Permission denied (public key). fatal: Could not read from remote repository. 
Please make sure you have the correct access rights and the repository exists.

I have read and write access to the repository push command git push -u origin master

Any idea?

1 Answer 1

0

You should try:

GIT_SSH_COMMAND="ssh -Tv" git push

You will see what Git is using as an SSH key, and if there are any error messages.

If the error persists, it is possible there is something preventing SSH to operate properly (as in here, when not connected to a VPN)

Using HTTPS, of course, is a workaround:

git remote set-url origin https://[email protected]/XXX.com/XXX.git

After discussion, the missing step was to add the private key to the ssh-agent

ssh-add OEDQ_BIT added the private key
Sign up to request clarification or add additional context in comments.

2 Comments

Comments are not for extended discussion; this conversation has been moved to chat.
Hi When I am using https it is working but I need to manually enter the password and username

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.