How to set up a connection to a remote Git repository


How to set up a connection to a remote Git repository, via SSH, on a Windows 7 computer. And, accordingly, download the content to your local server.

The remote repository is on a server with git. I just need to clone the content. no pushes back. there is identification. generated a public key and sent the special to the other side. how can I add my previously generated key via the console and connect to the server? what commands ..? Windows 7 on my machine.



If not already installed, you can get Git here. Along with it will be a unix-like Git Bash console.

Cloning over SSH

Example command for cloning over SSH.

git clone

In general, the command for cloning over SSH looks like this:

git clone git@server.domain:user/reponame.git

Do not confuse with HTTPS, which will require authorization via login-password:

git clone

Generating an ssh key.

On Windows, you can use both cmd and Git Bash, on * nix – just in the console. But I don't understand cmd, so I give instructions only for Git Bash & * nix:

ssh-keygen -t rsa -C ""

You can choose a passphrase, which improves reliability, but you will need to enter it each time you use it. If you forget, the key is useless for further use.

After executing the command, the public key appears accordingly in



It is the public key that needs to be transferred to the specialist on the other side. (You probably did so, but it's worth mentioning it anyway)

If everything is done correctly, then when you try to connect via ssh, the key will be used automatically.

If the key is already there

Then it must be put in c:\Users\%username%\.ssh . If the key name is different from id_rsa , then you need to create a file c:\Users\%username%\.ssh\config with the following content:

Host: server.domain
  IdentityFile путь_и_имя_ключа
Scroll to Top