git - Git文件夹被损坏
问题描述
我克隆了一个 Git 存储库到我的磁盘,它是一个分支
git clone -b branchname git-remote-repo.path.git branchname
一切正常,我可以提交更改并推送到远程仓库。
我使用 VS Code 并且没有 git 支持,我从命令行使用 git。
然后,有时,我不知道是什么原因造成的,我的 .git 文件夹损坏了,当我在文件夹中运行 git 命令时出现错误,例如 git status - 我得到了
fatal: Not a git repository (or any of the parent directories): .git
什么会导致这种情况,例如更改 VS Code 中的工作文件夹?
.git 文件夹仍然存在,但日志或对象等文件夹已被删除。
更多信息:
- 操作系统:Windows 10
- 我不将其用作动态文件夹
- 我在克隆的文件夹中执行 git 命令
- 我现在从 VS 代码中删除了 github 扩展,直到现在它才再次发生 :-)
- 我感觉在 VS 代码中更改工作文件夹可能会导致问题
几个小时后:-) 现在我再次拥有它,我承诺,我推送到远程仓库,一切都很好。我使用 VS Code 对其进行了开发,不再使用 github 扩展,然后:
C:\Projekte\Blender\Addons\fast-carve-2-8>git commit -a
[fast-carve-2-8 ec4e43d] sharpness 60 degree for bevel
1 file changed, 1 insertion(+), 1 deletion(-)
C:\Projekte\Blender\Addons\fast-carve-2-8>git push origin fast-carve-2-8
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 330 bytes | 330.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/jayanam/fast-carve.git
2c729eb..ec4e43d fast-carve-2-8 -> fast-carve-2-8
C:\Projekte\Blender\Addons\fast-carve-2-8>git status
fatal: not a git repository (or any of the parent directories): .git
解决方案
推荐阅读
- php - 为什么 FILES 数组返回上传错误 3
- python - 按创建日期过滤多个 csv 文件并连接成一个 pandas DataFrame
- python - Django重定向返回200但页面没有改变
- sas - SAS中分组值的组合
- python - 我的终端说我应该添加一条路径,但我已经有了(Windows 10)
- python - Elasticsearch、映射、日期映射问题
- c# - 使用 c# 进程对象获取有关 citrix 进程的唯一信息
- javascript - 如何在 javascript 中定位这些元素?(更多下文)
- python - 实现广度优先搜索
- java - 通过配置文件禁用 spring-context-indexer