Menu
Problem is, Bitbucket doesn’t allow you to use the same SSH key with more than one Bitbucket account.
Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to GitHub without supplying your username or password at each visit.
1. Open Git Bash.
2. Paste the text below, substituting in your GitHub/GitLab/Bitbucket email address.
3. ssh-keygen -t rsa -C “your_email@example.com”
4. When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the
default file location.
5. Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
6. At the prompt, type a secure passphrase/password.
7. Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
8. Go to C:\Users\\.ssh\id_rsa.pub
9. Copy All Content than Pest into (Go to bitbucket Setting -> Click on SSH Key -> Add New key)
1. Open Git Bash.
2. Paste the text below, substituting in your GitHub/GitLab/Bitbucket email address.
3. ssh-keygen -t rsa -f ~/.ssh/ -C “your_email@example.com”
– Example : ssh-keygen -t rsa -f ~/.ssh/ -C “your_email@youremail.com”
4. When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the
default file location.
5. Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
6. At the prompt, type a secure passphrase/password for the second account. Plz remember this
password its user for Push and Pull Command.
7. Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
8. Go to C:\Users\\.ssh\.pub
9. Copy All Content than Pest into (Go to bitbucket Setting -> Click on SSH Key -> Add New key)
When you have multiple identity files, consider creating an SSH config file to create aliases for your various identities. You can construct an SSH config file using many parameters and different approaches. The format for the alias entries used in this example is:
Host alias
containstbucket.org
IdentityFile ~/.ssh/config
To create a config file for two identities (worked and personalized), you would do the following:
1. Open a terminal window.
2. Edit the ~/.ssh/config file.
3. If you don’t have a config file, create one.
4. Add an alias for each identity combination for example:
1. To use multiple keys create a file at C:\Users\\.ssh\config with contents
similar to:
Host bitbucket.org User git
Hostname bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
2. Host bitbucket-accountB
Host bitbucket.org User git
Hostname bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
With this set up I can clone with my default key as Bitbucket suggests:
Example :Git clone git@bitbucket.org:username/project.git
This below repository contains Second Git Account
Example:Git clone git@bitbucket.org:username/project_demo.git
Just change host bitbucket.org of second git repository URL :
Syntax:Git clone git@bitbucket_:username/project_demo.git
Example:Git clone git@bitbucket_accountB:username/project_demo.git
git remote set-url origin git@<Default/other Account Host>:username/project_demo.git
git remote add origin git@<Default/other Account Host>:username/project_demo.git