Skip to content

Instantly share code, notes, and snippets.

@citmusa
Last active December 17, 2015 02:38
Show Gist options
  • Save citmusa/5536707 to your computer and use it in GitHub Desktop.
Save citmusa/5536707 to your computer and use it in GitHub Desktop.
remove directory not empty
https://confluence.atlassian.com/pages/viewpage.action?pageId=271943168
Create a SSH config file
When you have multiple identity files, create a SSH config file mechanisms to create aliases for your various identities. You can construct a SSH config file using many parameters and different approaches. The format for the alias entries use in this example is:
Host alias
HostName bitbucket.org
IdentityFile ~/.ssh/identity
To create a config file for two identities (workid and personalid), you would do the following:
Open a terminal window.
Edit the ~/.ssh/config file.
If you don't have a config file, create one.
Add an alias for each identity combination for example:
Host workdid
HostName bitbucket.org
IdentityFile ~/.ssh/workdid
Host personalid
HostName bitbucket.org
IdentityFile ~/.ssh/personalid
Close and save the file.
Now, you can substitute the alias for portions of the repository URL address as illustrated in the following table:
DVCS
Default address
Address with alias
Git
git@bitbucket.org:accountname/reponame.git
git@alias:accountname/reponame.git
Mercurial ssh://hg@bitbucket.org/username/reponame/ ssh://hg@alias/username/reponame/
There are lots of ways to use SSH aliasing. Another common use case may be the situation where you are using Bitbucket and GitHub on the same machine. The codingbadger suggested the following configuration for that use case:
# Default GitHub user
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/personalid
# Work user account
Host bitbucket.org
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/workid
If you google for "ssh aliases" or "ssh aliasing" you may find examples that suit you needs better.
git config --global color.ui auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment