小编Dan*_*Dan的帖子

为什么 git 无法识别我的本地存储库?

我刚刚回到一个我已经使用 Git 大约 6 个月的项目,看到了这个:

$ cd /d/DEVELOP/BlenderAe # My repo root
$ git status
fatal: not a git repository (or any of the parent directories): .git
Run Code Online (Sandbox Code Playgroud)

这绝对是正确的路径,为什么 git 无法识别我的本地克隆?

我最后的行动是:

  • 创建本地分支
  • 在本地分支上工作(在 VSCode 中切换到本地分支...罪魁祸首?)...
  • 已保存但未推送到远程(我永远不会再错过这一步!啊!)。

git文件夹内容如下:

$ cd /d/DEVELOP/BlenderAe # My repo root
$ ls .git
ORIG_HEAD  objects/  refs/
Run Code Online (Sandbox Code Playgroud)

我确实有当前的代码(在 git 之外对其进行了备份)。我该如何重新连接?还有我的 github 远程吗?


修复后ORIG_HEAD我看到:

$ git status
Not currently on any branch.
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        deleted:    (old_file1).py
        ...all …
Run Code Online (Sandbox Code Playgroud)

git github visual-studio-code

5
推荐指数
1
解决办法
3555
查看次数

标签 统计

git ×1

github ×1

visual-studio-code ×1