See the original post here.

If you manage multiple remote repositories across various remote repository hosting services with multiple accounts, this solution should help keep your dev mind a bit more sane!

BACKGROUND

Many developers are tasked with juggling dozens of repos that may exist on multiple services and potential multiple accounts within a single service. Utilizing standard SSH public/private key-pair technology reduces the manual labor of authenticating on every interaction with the service and is the ‘de facto’ mode of connecting and utilizing remote Git repositories.

Previously, the only way to manage this was to set a local configuration file within each repository. While that might be fine for a handful of repos, this doesn’t scale well when you have dozens of repos across multiple accounts/organizations (personal/work/clients/other) on multiple services (GitHub, BitBucket, Azure, etc.). Maintaining and backing up all those separate configuration files can be a nightmare, especially if you have need to regularly clear out and re-clone various repos.

Managing remote Git SSH authentication with multiple repos, across multiple accounts, and multiple services can be made much simpler by utilizing a specific directory structure and customizing a handful of configuration files.

INSTALL SETUP AND CONFIGURATION

This solution depends upon knowledge of directory structure/organization, passing familiarity with SSH key-pairs, basic terminal familiarity, and simple git configuration.

STEP 0 – PRELIMINARY ASSUMPTIONS

The following are a set of basic assumptions about the system environment that are relevant to this setup.

Your various remote git service accounts have the relevant SSH keys registered and working already. public/private key-pairs have been generated for each account the public keys have been registered with the relevant host of that account (GitHub, BitBucket, etc…) Your machine’s ssh agent has the keys added You know where to find the config file for ssh You are comfortable messing around in the terminal environment You are not a complete beginner with git NOTE: If you don’t know the difference between git and GitHub, then you should aquire that knowledge (and perhaps a bit more familiarity with the above tools/procedures before moving on with this setup.

STEP 1 – “ONE DIR TO RULE THEM ALL!”

Settle on a specific location to keep all of your Git repositories …

… read more here.