Git & GitHub

Git Clone Using Specific SSH Key #

SSH will look for the user’s ~/.ssh/config file. Add entries for each repository / key in the following way,

    Host vlabazdevops
      Hostname ssh.dev.azure.com
      IdentityFile ~/.ssh/id_rsa_vlab_ansible_az_devops
      IdentitiesOnly yes
      AddKeysToAgent yes

Add a remote git repository by referencing the host specified above

    git remote add origin git@myshortname:myrepo.git

To clone a repository using a specific SSH key, us the following command

    git clone git@<shortname>:<repo_url> -b <branch_name>
    git clone git@vlabazdevops:v3/AnsibleAutomation/ansible_linux/operations -b Development/Development