gpt4 book ai didi

git - "Does not appear to be a git repository"尝试通过 SSH 克隆时

转载 作者:行者123 更新时间:2023-12-02 14:17:39 25 4
gpt4 key购买 nike

我有一台运行 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 repo。
编辑 #2:已修复。遵循本指南,了解如何通过强制存储库使用 powershell(最底部)来直接指向 git 文件夹 https://github.com/PowerShell/Win32-OpenSSH/wiki/Setting-up-a-Git-server-on-Windows-using-Git-for-Windows-and-Win32_OpenSSH

**Note that git clone user@domain@servermachine:C:/test/myrepo.git does not work due to known issue. Work around it to set powershell asdefault Shell in registry. Or by following steps when cmd is defaultshell:

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 获取来源

最佳答案

在这里你可以找到一个完整的教程如何创建一个 repo。

https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server

该 repo 适用于 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 存储库。

关于git - "Does not appear to be a git repository"尝试通过 SSH 克隆时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56673762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com