gpt4 book ai didi

git - 为什么我收到消息 "fatal: This operation must be run in a work tree?"

转载 作者:IT王子 更新时间:2023-10-29 00:36:02 27 4
gpt4 key购买 nike

刚刚在 Windows 上安装了 git。我将 GIT_DIR 变量设置为 c:\git\并验证该环境变量由 cygwin 维护(即 echo $GIT_DIR 应该是什么)。我转到要为其创建 git 存储库的文件夹,假设为 c:\www,然后运行:

git init
git add .

然后我得到错误:

fatal: This operation must be run in a work tree

我不确定出了什么问题,但是 c:\git 目录有一个配置文件,上面写着:

[core]
repositoryformatversion = 0
filemode = false
bare = true
symlinks = false
ignorecase = true

我很确定这不应该是裸露的,这是我们的问题。

最佳答案

此外,您可能在 .git 子文件夹中,向上移动一个文件夹到您的项目根目录。

关于git - 为什么我收到消息 "fatal: This operation must be run in a work tree?",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1456923/

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