“似乎不是git存储库";尝试通过SSH克隆时 [英] "Does not appear to be a git repository" when trying to clone via SSH

查看:51
本文介绍了“似乎不是git存储库";尝试通过SSH克隆时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台运行Windows 10的计算机,我想托管一个git repo.OpenSSH正在运行,我能够通过Powershell SSH进入计算机,因此它是可连接的.

I have a Windows 10 machine running that I would like to host a git repo on. OpenSSH is running and I am able to SSH into the machine via Powershell, so it is connectable.

我在该计算机上的名为Test via的文件夹中创建了一个新的git

I created a new git on that machine in a folder named Test via

git init --shared --bare

我现在正尝试使用Sublime Merge和源URL进行克隆,如下所示:

I'm now trying to clone using Sublime Merge with the source URL like so:

ssh://USER@IP:/Test

但是,输入密码后,出现两个错误:

However, after I put in my password, I get two errors:

fatal: "/Test" does not appear to be a git repository

fatal: Could not read from remote repository

我已经尝试过搜索两个问题,但没有得到任何帮助.有人可以帮忙吗?

I've tried googling with both issues but have not gotten anything that has helped. Is anyone able to help?

我可以在远程计算机上本地克隆,提交和推送,因此它绝对是git repo.

I can clone, commit, and push locally on the remote machine, so it definitely is a git repo.

编辑#2:已修复.遵循本指南,了解如何通过强制存储库使用powershell(非常底部)直接指向git文件夹 https://github.com/PowerShell/Win32-OpenSSH/wiki/Setting-up-a-GitWindows上使用Git的Windows和Win32_OpenSSH服务器上的服务器

Edit #2: FIXED. Followed this guide on how to point directly to a git folder by forcing the repo to use powershell (very bottom) 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设置为注册表中的默认命令行管理程序.或通过在默认cmd时执行以下步骤外壳:

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

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

推荐答案

在这里,您可以找到完整的教程,了解如何仓促回购.

Here you can find a complete tutorial how to hast a repo.

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

该回购是针对Linux的,但我认为步骤应该相似.当您使用以下方法创建裸仓库时:

That repo is for linux but i think the steps should be similar. When you create a Bare-Repository with:

$ cd /srv/git
$ mkdir project.git
$ cd project.git
$ git init --bare
Initialized empty Git repository in /srv/git/project.git/

通常用 .git 命名文件夹.但是之后,您应该可以使用以下命令进行克隆.

It's common to name the folder with .git. But after that you should be able to clone with the following command.

git clone git@gitserver:/srv/git/project.git

因此,您已将路径添加到Git-Folder.我认为那是你的问题.您只能从根目录尝试路径"/Test".可能是错误的,Git告诉您该文件夹不是Git存储库.

So you have add the path to the Git-Folder. I think that is your problem. You try only the path "/Test" from your Root-Directory. That could be wrong and Git tell you that this folder is not a Git-Repository.

这篇关于“似乎不是git存储库";尝试通过SSH克隆时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆