DEV Community

loading...
Cover image for Setup Bitbucket for Mac OS

Setup Bitbucket for Mac OS

hello_vatsal profile image Vatsal ・1 min read

Once you have created new repository on your bitbucket account and you're trying to clone project on local machine and you end up with error saying,

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

We all hate errors

So follow these steps to get started quickly

  • Go to terminal
  • cd ~/.ssh/
  • ssh-keygen -C username@domain.com and hit return
  • Enter unique file name for that keypair
  • Now you should be able to check if it's successful or not by ls ~/.ssh/ , try to look for unique keypair name that you entered while creating
  • Now we don't want to enter password every time we're trying to access that keypair so add them into ssh agent by eval <acute-key> ssh-agent <acute-key>
  • ssh-add -K ~/.ssh/<private_key_file>
  • Also we want to keep this change every time computer restarts to add it into ssh config file nano ~/.ssh/config then add following and exit
Host *
  UseKeychain yes
  • Now we have to add public key to our bitbucket account so first copy the public key with pbcopy < ~/.ssh/<unique-key>.pub So, for Mac OS users you have copied it into your clipboard.
  • Now add that into your bitbucket ssh key and hit save

Done !!
Happy Programing :)

Discussion (0)

pic
Editor guide