4

Windows 10 now includes a built in sshd server. That means I should be able to access my git repositories located on the windows machine with

git clone ssh://myid@mywinmachine/myrepos/repo1.git  

However, the above is not working. I am getting

fatal: ''/myrepos/repo1.git'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

I think the problem is, that there is a confusion of the directory location of my git repository on mywinmachine.

And I am not sure how to solve this. My git repository is located at c:\myrepos\repo1.git on mywinmachine (It is actually in another location, but I created a junction). (I also tried to have symlink (junction) at c:\users\myid\myrepos -- did not help either.)

when I do ssh myid@mywinmachine , everything is ok. I login fine, and I am being put into c:\users\myid machine (into a cmd prompt).

I had setup Git Windows my mywinmachine, such that any git command is accessible from any command prompt). So while on mywinmachine, if I type: git --version, I get correct responses

myid@mywinmachine C:\Users\myid>git --version
git version 2.18.0.windows.1

What I am doing wrong? What path should I be specifying for git clone ssh:// , to get to my repositories located on mywinmachine ?

Note, I cannot mount the windows directory, because my development box is OpenBSD (6.3), and that does not include a way to mount samba compatible shares... (no mount_smbfs, no cifs). So the only what I could figure how to access my Windows-based git repos is by ssh.. and that's leading me into this 'rabbit hole'.

I do not use key based authentication, going through interactive password.

sshd_config is the default, that was installed by windows. I did not make any changes to it.

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_dsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ecdsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile  .ssh/authorized_keys

#AuthorizedPrincipalsFile none

# For this to work you will also need host keys in %programData%/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem   sftp    sftp-server.exe

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server
1
  1. Read for hints and ideas
  2. Try pure SSH before clone (with existing junction) - login, ls, cd: i.e. check access-permissions of user/process (I'll expect trouble here most probably)

At last, you can clone your repo into your ssh-$HOME for path|permissions problem's simplification

1

I ran into the same issue and what worked for me is changing the default shell for OpenSSH to the git bash.exe. The problem seems to be with the path quoting.

See https://stackoverflow.com/questions/53834304/how-do-i-git-clone-from-a-windows-machine-over-ssh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.