0

I have created a project in bitbucket and trying to push code using intellij git. When I created the project bitbucket gave me commands to run within git. Here are the commands I ran and the error I got:

git remote add origin ssh://git@bitbucket.org/[username]/[repo]
git push -u origin master

This looks strange because how is this command suppose to authenticate me? Now here is error I got.

Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Any ideas?

Luke101
  • 63,072
  • 85
  • 231
  • 359
  • 1
    Possible duplicate of [GitHub Error Message - Permission denied (publickey)](https://stackoverflow.com/questions/12940626/github-error-message-permission-denied-publickey) – aydinugur Jun 19 '17 at 00:15

2 Answers2

4

That is because you are creating your project via ssh and for that you need to create and registrate SSH keys.

Create ssh key

If you don't want that, create your project only via https

  • This shows how to generate the private and public keys. But how do i register the private key on my system? And tell intellij I have a registered private key? – Luke101 Jun 19 '17 at 02:00
2

Do you have the ssh key added to your computer? If you're using oSX El Capitan or newer you'll need to add these every time you restart. osx ssh keys

How to add ssh keys