#Instructions for enabling your local machine to use both BitBucket and GitHub
Ok, so you want to configure your machine to use BitBucket. The options are:
- Use the SourceTree Client
- Configure SSH to use git with Terminal
The first one is self explanatory, so we will focus on the second one.
If you want to use BitBucket via Terminal, chances are you want to configure SSH, and also are already using GitHub.
The bad news is, BitBucket makes this process just a little bit more difficult, but not by much. The worse news is, that since you are already using GitHub, you need to spend about 30 minutes doing some reading so you can do a proper config on your system.
What you are going to do is generate an SSH key inside your system, configure a BitBucket alias, and then paste that key into your user settings in your BitBucket account page. Here goes:
- Open terminal to your root user menu (
$: cd ~/
) - Run the command
ssh-keygen
and give your key a name. Something likebitbucket_id
should be ok. - Move the two created files (in this case
bitbucket_id
andbitbucket_id.pub
into the~/.ssh
directory. - If you don't have a config file, create a file called
config
in the~/.ssh
directory. - Add the following config to the file:
Host bitbucket.org
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/bitbucket_id
- This config file allows you to store multiple aliases, so you can use GitHub as well as BitBucket from your Terminal automatically, with unique SSH keys for each. (See the links below for more info)
- Copy your SSH out of the file you generated, then log into BitBucket, go to your user settings, create a new key and paste it in.
- You should now be able to pull from and push to repos.
###You can read more about alias configuration and SSH keys here
And use this article plus this article to fill in any gaps in your knowledge.