How to link a SQL Server database to a Git repository using the SSH protocol

Applies to
ApexSQL Source Control

Summary
This article explains how to link a database to a Git repository using the SSH protocol generated by OpenSSH or Putty

Description
ApexSQL Source Control natively supports different protocols that can be used to connect to a Git repository. This includes HTTP, HTTPS, File and SSH protocols. In this article we‘ll go through the process of generating a key pair using Putty and OpenSSH and linking a database using the SSH protocol.

ApexSQL Source Control searches for the key pair in the following location:

C:\Users\<username>\.shh

Where id_rsa is the private key and id_rsa.pub is the public key.

Once you generate a key using Putty, you should copy the public part of the key to C:\Users\<username>\.shh\id_rsa.pub, as presented in the following picture:

For the private part of the key, export the key into the C:\Users\<username>\.shh folder and name it ‘id_rsa’. Remember to type in a key passphrase before exporting it.

After this is done, you should store the public key on the server and that should enable you to link a database.

Quick tip icon

Quick tip:

Remember that repository format when you link a database using ssh protocol has to start with ssh:// as presented in the following example:
ssh://git_fjutina@fjutina.git.cloudforge.com/testGit.git

In case that you decide to use Openssh for key pair generation, just use the command ssh-keygen –t rsa as shown in the following picture:

It will automatically place the keys in the right location and the only thing that is left for you to do is to place the public key on your Git server.

  • Q: What is SSH?

    A: SSH or Secure Shell is an encrypted network protocol used for secure communication over the internet.

  • Q: What source control systems is it used with?

    A: ApexSQL Source Control supports SSH connections for Mercurial, Git and Subversion.

  • Q: What is the main advantage of SSH protocol?

    A: Data sent via SSH is strongly encrypted and thus less susceptible to attacks.

  • Q: Which key generator is preferred, OpenSSH or Putty?

    A: OpenSSH is the standard when it comes to SSH protocol and most servers will accept its key file format. Putty has its own key file format and it needs to be exported into a proper SSH format in order to work with most Git hosting services.