How to sync your Git Repo with SSH Key

  1. Create a Key for you
    • eval “$(ssh-agent -s)” to enable the Agent for the SSH
    • ssh-keygen and then provide the required path ti generate the ssh file
      ex: D:/folder1/sshtest
    • sshtest is the SSH file that generated from the system
    • This will create two files inside the provided folder as
      • sshtest
      • sshtest.pub
    • sshtest is your private key and the sshtest.pub is the public key for the connection.

Add the pub key to Azure

  1. Add your public key to the Azure account under the SSH public keys
    • Open the sshtest.pub file in a text editor and copy the contents.
    • Go to the SSH pubic key menu in Azure –> User settings –> SSH public Key

Config the server

  • Now copy your private key into the server or PC. In my sample I am using a Ubuntu server and copy my public key into the ~/.ssh folder which is the standard.
  • Now public key need add to the SSH Agent with its location by using the ssh-add command.
    • ssh-add !/.ssh/sshtest
  • If your SSH agent is not enable, you can run the below command before execute the previous command.
    • eval "$(ssh-agent -s)"
  • Sometime you may get warning message wile executing the ssh-add because of the file permission level. In that case, set the required permission level as
    • chmod 600 sshtest

How to sync the Git

  • Go to the folder which you need to sync your repository.
  • run the “git clone git@ssh.dev.azure.com:v3/….”

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + 1 =

Related Post