我有一台正在运行的Windows 10机器,我想在上面托管一个git存储库。OpenSSH正在运行,我能够通过Powershell通过SSH连接到机器,因此它是可连接的。
我在那台机器上名为 Test 的文件夹中创建了一个新的 git
git init --shared --bare
我现在正在尝试使用Sublime Merge与源URL进行克隆,如下所示:
ssh://USER@IP:/Test
但是,输入密码后,出现两个错误:
fatal: "/Test" does not appear to be a git repository
fatal: Could not read from remote repository
我尝试在谷歌上搜索这两个问题,但没有得到任何帮助。有人能帮忙吗?
编辑:我可以在远程机器上本地克隆、提交和推送,所以它绝对是一个 git 存储库。
编辑#2:固定。按照本指南介绍如何通过强制存储库使用 powershell(最底部)https://github.com/PowerShell/Win32-OpenSSH/wiki/Setting-up-a-Git-server-on-Windows-using-Git-for-Windows-and-Win32_OpenSSH 直接指向 git 文件夹
**请注意,由于已知问题,git clone user@domain@servermachine:C:/test/myrepo.git 不起作用。解决方法是将电源外壳设置为 注册表中的默认命令行管理程序。或者当 cmd 是默认时按照以下步骤操作 壳:
cd c:mygitrepros # initialize a local repo folder git init mylocalrepo cd mylocalrepo # add the remote repro git remote add origin user@domain@servermachine:C:/test/myrepo.git # work around the known issue by launching powershell to run the git commands git config --local remote.origin.uploadpack "powershell git-upload-pack" git config --local remote.origin.receivepack "powershell git-receive-pack"
git 获取来源
在这里你可以找到一个完整的教程,如何设置一个存储库。
https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
该存储库适用于 linux,但我认为步骤应该相似。当您使用以下命令创建裸存储库时:
$ cd /srv/git
$ mkdir project.git
$ cd project.git
$ git init --bare
Initialized empty Git repository in /srv/git/project.git/
通常使用.git
命名文件夹。但是在那之后,您应该能够使用以下命令进行克隆。
git clone git@gitserver:/srv/git/project.git
因此,您已将路径添加到 Git 文件夹。我认为这是你的问题。您只尝试根目录中的路径"/Test"。这可能是错误的,Git 会告诉你这个文件夹不是 Git 存储库。