Instead of using username / password to authenticate with the Git (git) command-line when cloning repositories, Git supports the use of the more secure option to use SSH Public / Private Key Pairs. Here’s the simple steps to follow to generate an SSH Key Pair and set it up with Azure DevOps Repositories to be able to use Git locally to clone and work with those repositories using the Git CLI.
- You first need to generate a new SSH key pair. This command will create a new public / private SSH key that will be used to authenticate Git with Azure DevOps:
ssh-keygen -t rsa -m PEM -f "/Users/<username>/.ssh/my_devops_sshkey" -C "my_devops_sshkey"
Replace the<username>placeholder with your local username for your/Users/folder.
Also, you’ll want to name the SSK Key something other thanmy_devops_sshkeythat’s appropriate for your use. - Next, the Private Key needs to be added to the macOS Key Chain so it can be used. This command will add it for you:
ssh-add --apple-use-keychain /Users/<username>/.ssh/my_devops_sshkey
Replace the<username>placeholder with your local username for your/Users/folder. - Now that you have a Public/Private SSH Key pair generated with the Private key registered with macOS for use, you need to add it to Azure DevOps SSH Keys to support your use of this key pair for authenticating
gitto be able to clone repositories. Navigate into your Azure DevOps, then go to User Settings -> SSH public keys and add the/Users/<username>/.ssh/my_devops_sshkey.pubPublic Key file contents there key there:
- Now that you have the new SSH key pair created, registered locally, and registered in Azure DevOps SSH Keys, you’ll now be able to Git Clone (
git clone) repositories in your Azure DevOps organization using the SSH repository location.
Here’s an example Git CLI clone command using the SSH URL location for an Azure DevOps git repository:git clone git@ssh.dev.azure.com:v3/<org>/<project>/<repo>
The above steps includes some placeholders like <username>, <project> and others that you’ll need to fill in with your appropriate values before running these commands.
Original Article Source: Azure DevOps: Create SSH Key to Authorize Git on macOS written by Chris Pietschmann (If you're reading this somewhere other than Build5Nines.com, it was republished without permission.)
Microsoft Azure Regions: Interactive Map of Global Datacenters
Create Azure Architecture Diagrams with Microsoft Visio
Implementing Azure Naming Conventions at Scale with Terraform and Build5Nines/naming/azure (AzureRM + Region Pairs)
Unlock GitHub Copilot’s Full Potential: Why Every Repo Needs an AGENTS.md File
New Book: Build and Deploy Apps using Azure Developer CLI by Chris Pietschmann




Worked! Thank you Chris
Thank you very much!