我有一台运行 Windows 10 的计算机,我想在其上托管 git 存储库。OpenSSH 正在运行,我可以通过 Powershell 通过 SSH 连接到机器,因此它是可连接的。
我在该机器上名为 Test 的文件夹中创建了一个新的 git via
git init --shared --bare
Run Code Online (Sandbox Code Playgroud)
我现在尝试使用 Sublime Merge 和源 URL 进行克隆,如下所示:
ssh://USER@IP:/Test
Run Code Online (Sandbox Code Playgroud)
但是,当我输入密码后,出现两个错误:
fatal: "/Test" does not appear to be a git repository
fatal: Could not read from remote repository
Run Code Online (Sandbox Code Playgroud)
我尝试过用谷歌搜索这两个问题,但没有得到任何有帮助的信息。有人能帮忙吗?
编辑:我可以在远程计算机上本地克隆、提交和推送,所以它绝对是一个 git 存储库。
编辑#2:已修复。遵循本指南,了解如何通过强制存储库使用 powershell(最底部)来直接指向 git 文件夹https://github.com/PowerShell/Win32-OpenSSH/wiki/Setting-up-a-Git-server-on -Windows-使用-Git-for-Windows-and-Win32_OpenSSH
**请注意,由于已知问题,git clone user@domain@servermachine:C:/test/myrepo.git 不起作用。解决这个问题,将 powershell 设置为注册表中的默认 Shell。或者当 cmd 是默认 shell 时执行以下步骤:
Run Code Online (Sandbox Code Playgroud)cd c:\mygitrepros # initialize a local repo folder git init mylocalrepo cd mylocalrepo # …