无效:这是一个 git 存储库吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29912256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:08:09  来源:igfitidea点击:

not valid: is this a git repository?

gitgithubclonegerritgitblit

提问by Farrukh Chishti

My question is NOT thisquestion.
On performing a git cloneI am getting this error. Command than I am using is:

我的问题不是这个问题。
执行 agit clone我收到此错误。比我使用的命令是:

$ git clone "https://gdt.test.com/gitblit/log/?r=mytest.git&h=refs/heads/branch_development"

On simply running:

简单地运行:

$ git clone "https://gdt.test.com/gitblit/log/?r=mytest.git"

I get the error:

我收到错误:

fatal: could not create work tree dir '?r=mytest'.: Invalid argument

I think I need to put the full URL along with r and h parameters. Because these parameters specify the name of my repository.

我想我需要把完整的 URL 连同 r 和 h 参数。因为这些参数指定了我的存储库的名称。

I was doing a mistake (copying and pasting the URL). However, even on using the URL:

我做错了(复制和粘贴 URL)。但是,即使使用 URL:

gdt.test.com/gitblit/r/mytest.git/

I am getting error:

我收到错误:

'fatal: repository 'gdt.test.com/gitblit/r/mytest.git/'; not found. 

How to copy correct URL from gitblit summary page?

如何从 gitblit 摘要页面复制正确的 URL?

采纳答案by Farrukh Chishti

Got the problem. I was using the wrong git repository altogether. Correct URL must be:

得到了问题。我完全使用了错误的 git 存储库。正确的网址必须是:

git clone https://[email protected]/gerrit/mytest

回答by James Moger

Problem: you are copying & pasting the log webpage URL and expecting to be able to clone a repository from the generated html.

问题:您正在复制和粘贴日志网页 URL,并希望能够从生成的 html 中克隆存储库。

The proposed successful answer has sufficiently scrubbed the URL which hides the solution from you: you are missing the repository serving path in the URL, /r/or /git/.

建议的成功答案已充分清除了对您隐藏解决方案的 URL:您缺少 URL 中的存储库服务路径, /r//git/.

Using your URL example, the correct syntax should be:

使用您的 URL 示例,正确的语法应该是:

git clone https://gdt.test.com/gitblit/r/mytest.git

git clone https://gdt.test.com/gitblit/r/mytest.git

The Summary page provides generated URLs with copy & paste functions to avoid these type of errors.

摘要页面提供带有复制和粘贴功能的生成 URL,以避免此类错误。

enter image description here

在此处输入图片说明

回答by Mayur Nagekar

The url is not the path to a git repository BUT yes mytest.git is a bare repository

url 不是 git 存储库的路径,但是是的 mytest.git 是一个裸存储库

Edit: Try this and it works at my end

编辑:试试这个,它在我的最后工作

git clone https://gdt.test.com/gitblit/log/mytest.git

git clone "https://gdt.test.com/gitblit/log/mytest.git"
Cloning into 'mytest'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.