Skip to content

Git client SSH Configuration on Windows

Option1: Gitbash environment

Install Gitbash

Gitbash is embedded in Git for Windows. Download

SSH Key generation and get repository

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
$ mkdir ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t rsa -C "tato.flam@gmail.com"
# do not need to add password for gitlab.fabcloud.org)

$ cat id_rsa.pub
# copy the public key and add to gitlab.fabcloud.org > settings > ssh key

$ ssh -T git@gitlab.fabcloud.org
Welcome to GitLab, @<git name>!
# Check SSH configuration

$ mkdir "<local repository directory>"
# mkdir ~repo/gitlab_fab/tatsuro.homma

$ cd "<local repository directory>" 
# cd ~repo/gitlab_fab/tatsuro.homma

$ git clone "<your remote repository>"
# git clone git@gitlab.fabcloud.org:tatsuro.homma/fabacademy.git

Option2: WSL2 environment

Install WSL2

Install WSL2 on Windows10

SSH Key generation and get repository (Do the same as above)

What I solved on configuration for WSL2 are:

  • generate ssh key with email address
  • add ssh key to ssh agent
  • check .ssh/config
  • check /etc/resolv.conf
    • Change name server address to 8.8.8.8

Trouble shooting

If you cannot access to remote repository, see Git - change remote URL or search error message on internet.

References


Last update: April 9, 2021