0

I stood up CentOS 7 nix OS via Oracle VM VirtualBox from Windows 11 workstation. Then I installed latest gitlab via Docker. So far I was able to do followings:

  • gitlab is running successfully
  • I was able to access its web console from a browser
  • I was able to create new user (non-root) as John
  • I was able to create a new project as hello-world and create ssh key pairs for that user
  • I have git bash running on Windows 11 and ran ssh-keygen to create key pairs

The problem I am having is when I tried to run git clone git@localhost:john/hello-world.git I am getting ssh: connect to host localhost.com port 22: Connection timed out fatal: Could not read from remote repository..

I read a few articles about it including this and tried its suggested solution although I didn't understand it: ssh: connect to host github.com port 22: Connection timed out

I'd appreciate if someone could explain to me why this is happening/how to resolve it. I am newbie in linux + networking + ssh.

Update:

This is not a solution to the question I posted but workaround temp solution for me.

Instead of using ssh key, I decided to use username/password which allowed me to download the repo in git bash. I did two things.

  1. I added VM's IP address and its hostbame on C:\Windows\system32\drivers\etc\hosts - This I should have done first, newbie's mistake.
  2. Afterward, I ran git clone http://john@localhost/john/hello-world.git
DaeYoung
  • 1,161
  • 6
  • 27
  • 59
  • 2
    Make sure your server is running an ssh server (`sshd`). Make sure your network configuration allows ssh traffic. This is a server setup issue, suitable for superuser.com or (more likely) serverfault. – torek Aug 05 '22 at 16:40
  • 1
    This is more an ssh issue than a Git issue. Make sure you can ssh to your VM first. – Schwern Aug 05 '22 at 17:06

1 Answers1

1

First make sure you can access your VM through ssh at all : run

ssh <user>@<host>

# you can add '-v' to have more information on what ssh is trying to do

Two remarks :

  • host: if your VM is accessible through your hosts network, it won't be with the 127.0.0.1 IP (localhost). Try to connect to the VM's IP, or, if you added a name for your VM in your etc/hosts, to this name : ssh git@mylocalvm

  • user account: you mention you created a john account, but not a git account. Either create a non root git account on your VM, or try ssh john@mylocalvm

LeGEC
  • 46,477
  • 5
  • 57
  • 104