带有"--stdin需要git存储库"的git克隆失败; [英] git clone failure with "--stdin requires a git repository"

查看:146
本文介绍了带有"--stdin需要git存储库"的git克隆失败;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此问题感到困惑,不知道为什么会发生.

I am puzzling on this issue and stuck here with no clue why it happens.

我正在使用git clone从bitbucket获取我的仓库,例如"git clone git@bitbucket.org:mycompny/therepo.git"

I am using git clone to get my repo from bitbucket like "git clone git@bitbucket.org:mycompny/therepo.git "

但是,我失败了,例如:

But, I am failed with something like:

fatal: --stdin requires a git repository
fatal: index-pack failed

推荐答案

您可以看到该错误消息

You can see that error message introduced in 2016 here:

内置的index-pack被标记为 RUN_SETUP_GENTLY ,因为在任何存储库之外的文件系统中对一个包进行索引都非常好.
但是,-stdin 模式会将结果写入对象数据库,而不会在存储库之外有意义.这样做会创建一个伪造的" .git "目录,除了新创建的包及其索引外,其中没有任何其他内容.

The index-pack builtin is marked as RUN_SETUP_GENTLY, because it's perfectly fine to index a pack in the filesystem outside of any repository.
However, --stdin mode will write the result to the object database, which does not make sense outside of a repository. Doing so creates a bogus ".git" directory with nothing in it except the newly-created pack and its index.

错误的原因是当前文件夹不是git目录.

The cause of the error is that the current folder is not a git directory.

检查您当前的文件夹,并确保其路径已存在.

Check your current folder, and make sure its path is an existing one.

这里,根本原因是使用Cygwin,而不是 Git附带的git bash.对于Windows .

Here, the root cause is using Cygwin, instead of the git bash included with Git For Windows.

OP云飞添加了

如果我使用" git bash "中包含的git,通过将其导出到cygwin中的环境中,也可以使其在cygwin中正常工作.

If I use the git included from my "git bash", by exporting it into my environment in cygwin, I can make it work from cygwin as well.

只需执行 export PATH ="/cygdrive/c/Program Files/Git/cmd":$ PATH

Cygwin必须在Cygwin软件包列表中包含一个Git版本( 2.21 ).与适用于Windows的Git 的其他组件不兼容:使用Windows版Git的git.exe 更安全.

Cygwin must include a Git version (2.21 in the Cygwin package list) which was not compatible with other components from Git for Windows: using the git.exe from Git for Windows is safer.

这篇关于带有"--stdin需要git存储库"的git克隆失败;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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