Windows 10 现在包含内置的 sshd 服务器。这意味着我应该能够访问位于 Windows 计算机上的 git 存储库
git clone ssh://myid@mywinmachine/myrepos/repo1.git
Run Code Online (Sandbox Code Playgroud)
但是,上面的方法不起作用。我正进入(状态
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.
Run Code Online (Sandbox Code Playgroud)
我认为问题是,mywinmachine 上的 git 存储库的目录位置存在混乱。
我不知道如何解决这个问题。我的 git 存储库位于 mywinmachine 上的 c:\myrepos\repo1.git (它实际上在另一个位置,但我创建了一个连接)。(我还尝试在 c:\users\myid\myrepos 处建立符号链接(连接点)——也没有帮助。)
当我执行 ssh myid@mywinmachine 时,一切正常。我登录正常,并且被放入 c:\users\myid 机器(进入 cmd 提示符)。
我在 mywinmachine 上设置了 Git Windows,这样就可以从任何命令提示符访问任何 git 命令。因此,在 mywinmachine 上,如果我输入: git --version,我会得到正确的响应
myid@mywinmachine C:\Users\myid>git --version
git version 2.18.0.windows.1
Run Code Online (Sandbox Code Playgroud)
我做错了什么?我应该指定什么路径来
git clone ssh://访问位于 mywinmachine 上的存储库?
请注意,我无法挂载 windows 目录,因为我的开发盒是 OpenBSD (6.3),并且不包括挂载 samba 兼容共享的方法...(没有 mount_smbfs,没有 cifs)。因此,我唯一能想到的就是通过 ssh 访问我的基于 Windows 的 git 存储库,而这让我陷入了这个“兔子洞”。
我不使用基于密钥的身份验证,而是通过交互式密码。
sshd_config 是默认值,由 Windows 安装。我没有对它做任何改变。
# 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
Run Code Online (Sandbox Code Playgroud)