我有一台运行 Windows 10 的计算机,我想在其上托管 git 存储库。 OpenSSH 正在运行,我可以通过 Powershell 通过 SSH 连接到机器,因此它是可连接的。
我在该机器上名为 Test 的文件夹中创建了一个新的 git via
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 来直接指向 git 文件夹(非常底部)https://github.com/PowerShell/Win32-OpenSSH/wiki/Setting-up-a-Git-server-on-Windows-using-Git-for-Windows-and-Win32_OpenSSH https://github.com/PowerShell/Win32-OpenSSH/wiki/Setting-up-a-Git-server-on-Windows-using-Git-for-Windows-and-Win32_OpenSSH
**请注意,由于已知问题,git clone user@domain@servermachine:C:/test/myrepo.git 不起作用。解决这个问题,将 powershell 设置为
注册表中的默认 Shell。或者当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 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 存储库。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)