Skip to main content

2 posts tagged with "git"

View All Tags

Delete All Git Branches that Follows a Pattern

· One min read

I try to write one article for each day. When I get time, I write articles for future dates also. I then keep each future articles in their own branch names like 2023-02-04, 2023-02-05. On the day of publishing, I merge the corresponding branch to master branch.

Connect To Two Bitbucket Accounts From Mac Using SSH

· One min read

I have two accounts in Bitbucket. One is my personal account which I registered using my personal email account. Other one is my official account registered using my office email. When I moved from HTTP to SSH in Bitbucket, I had to generate two separate SSH keys for both accounts.

So now I have two SSH keys in my laptop. When trying to push code to my personal account, how can Bitbucket know which SSH key to use? I faced this issue. My already working repo start yelling that I do not have access to the repo.

To teach Bitbucket which SSH key to use with which account, we need to do following steps.

First, create a file in ~/.ssh folder with name config. No extensions!. My SSH keys are stored in ~/.ssh folder.

Open config file in some editor and paste following content:

 #Personal account
Host bitbucket.org-jobyjoseph
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes

#Official account
Host bitbucket.org-jobylitmus7
HostName bitbucket.org
User git
IdentityFile ~/.ssh/ed25519_bitbucket_litmus7
IdentitiesOnly yes

Replace jobyjoseph and jobylitmus7 with your Bitbucket user names. Then replace id_ed25519 and ed25519_bitbucket_litmus7 with the file names of your SSH files.