Cloning an Azure DevOps Git Repo with SSH on MacOS
Rich Minchuk -
If you want to commit work to multiple private git repos, You may want to use SSH. Trying to jump between two separate repos, and forgetting my credentials, I finally made the switch. Following is a brief overview of how to setup an Azure DevOps git repo for access via SSH.
Open your public key in textedit or print it in terminal.
if you don't have a public key on your machine: execute the following command.
ssh-keygen -t rsa -C "[your email]" cat ~/.ssh/id_rsa.pub
When you execute the command, you have a few options. First, whether you want to put the file in a non standard directory. Second giving your private key a passphrase. You can skip this, but if you do, you risk exposing any services, that know your public key, to attack if your machine is lost or stolen. If you do chose to add a passphrase to your private key, you'll have to configure ssh differently.
Copy and paste your public key into your Azure DevOps repo by navigating to [your user icon] > security > SSH public keys > add
Give your public key a descriptive name, like [your name] + [your pc model] + " Public Key"
In my case, "Rich's 2017 MacBook Pro Public Key."
Then paste your Public Key into the key field and hit save.
Bingo. Now you can:
mkdir ~/Source cd ~/Source/ git clone ssh://email@example.com:22/myproj/_ssh/myproj