Manage Multiple SSH key in one Computer

It's frustate me this morning knowing that I can't pull my own personal repository from bitbucket which saving several of my own library scripts. How's this problem happen? After doing some research, I knew that one ssh-key in a computer must be associated with only one Bitbucket Account, . So, it will be denied when I tried to use the same key into my personal bitbucket account.

conq: repository access denied.
fatal: Could not read from remote repository.

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

How to fix it? I have to create multiple ssh-key for usage at Bitbucket. Let's try to do it.

  • First, we have to create new ssh-key for each accont. Open Terminal (Mac or Linux) / Git Bash (Windows)
  • Open ssh directory and create two new ssh key, one for work account and one for personal account

    $ cd ~/.ssh/
    $ ssh-keygen

Ssh keygen Ssh keygen2

  • Let's open Bitbucket in web browser. Login to work account, add work ssh-key created before. After you save configuration, logout from it.
  • Repeat same step for personal acccount.
  • Now we have different ssh-key for each account in Bitbucket. Let's try to pull some repository.

Pull access denied

  • Uh oh, It still disabled. Let's check when our ssh key is available in our computer by using command ssh-add.

    $ ssh-add -l

Ssh add list

  • If there is no identities in our computer. We should add our keys manually. We can use command ssh-add to adding our keys. I'll be adding two of mine using ssh-add command.

    $ ssh-add ~/.ssh/work
    $ ssh-add ~/.ssh/personal

  • Last step, you have to create config file at ~/.ssh/ to tell Git which identity will be used in which account.

    Host workid
    IdentityFile ~/.ssh/work
    Host personalid
    IdentityFile ~/.ssh/personal

  • That's it. Now, I can pull and managing reopsitories using different accounts in Bitbucket. This method can be used when using another server.

Fix Application Damaged in MacOS Sierra

Today, I updated my workmate into MacOS Sierra which is have more beautiful look than before. After I installed few applications, I've got some problem when installing my personal application which have not identified which verified developer key. Like the last version, I need to change Application Install permission at System Preferences > Security & Privacy > General. And I found that the third option, Allow app downloaded from Anywhere is missing.

MacOS sierra security general

Okay, now I can only installing app from App Store and Identified Developer which make my personal app to handle several script for automation cannot run. After doing some googling, I found that we can force choosing that option from terminal. Here is the command.

~$ sudo spctl --master-disable

Now, you can see third option, Allow App from Anywhere, is available in Security & Privacy.

MacOS Sierra security general off

If you just want to allow app only from app store and Identified Developer, just type this command:

~$ sudo spctl --master-disable

Happy Research!