git repo 出现奇怪的问题?
我刚刚在 Mac 上升级到 OSX Lion,并且在 git 存储库中遇到了一个奇怪的问题。我的 .vim 文件处于版本控制之下,其中许多插件配置为 git 子模块。升级后,我在 .vim 目录中运行 git status 命令并得到以下信息:
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
有人知道我的问题是什么吗?我在Google和SO上搜索了上述错误消息,但没有找到任何答案。我还注意到 git 现在似乎很慢。另外,我在其他 git 存储库中没有其他问题(预计缓慢问题),这让我认为该问题与 Lion 无关。有人对如何修复我的 .vim 存储库有任何建议吗?预先感谢您的帮助。
以下是 drizzd 请求的一些跟踪输出:
setup: worktree: /Users/sbrown/.vim/bundle/supertab
setup: cwd: /Users/sbrown/.vim/bundle/supertab
setup: prefix: (null)
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
setup: git_dir: .git
setup: worktree: /Users/sbrown/.vim/bundle/surround
setup: cwd: /Users/sbrown/.vim/bundle/surround
setup: prefix: (null)
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
setup: git_dir: .git
setup: worktree: /Users/sbrown/.vim/bundle/tasklist
setup: cwd: /Users/sbrown/.vim/bundle/tasklist
setup: prefix: (null)
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
setup: git_dir: .git
setup: worktree: /Users/sbrown/.vim
setup: cwd: /Users/sbrown/.vim
setup: prefix: bundle/vim-colors-solarized/
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
I just upgraded to OSX Lion on my Mac and I aquired a strange problem with a git repo. I have my .vim files under version control with a number of plugins configured as git submodules. After upgrading, I ran a git status
command into my .vim directory and got the following:
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
fatal: git status --porcelain failed
Does anyone know what my problem is? I searched the above error message on Google and SO, but I didn't find any answers. I've also noticed that git seems to be very slow now. Also, I have no other problems in other git repos (expect the slowness problem), which makes me think the problem is not related to Lion. Does anyone have any suggestions for how I can fix my .vim repo? Thanks in advance for the help.
Here is some of the trace output requested by drizzd:
setup: worktree: /Users/sbrown/.vim/bundle/supertab
setup: cwd: /Users/sbrown/.vim/bundle/supertab
setup: prefix: (null)
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
setup: git_dir: .git
setup: worktree: /Users/sbrown/.vim/bundle/surround
setup: cwd: /Users/sbrown/.vim/bundle/surround
setup: prefix: (null)
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
setup: git_dir: .git
setup: worktree: /Users/sbrown/.vim/bundle/tasklist
setup: cwd: /Users/sbrown/.vim/bundle/tasklist
setup: prefix: (null)
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
setup: git_dir: .git
setup: worktree: /Users/sbrown/.vim
setup: cwd: /Users/sbrown/.vim
setup: prefix: bundle/vim-colors-solarized/
trace: built-in: git 'status' '--porcelain'
trace: run_command: 'status' '--porcelain'
trace: exec: 'git' 'status' '--porcelain'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了将来参考,我解决问题的唯一方法是删除所有子模块,然后重新安装它们。
For future reference, the only way I could correct the problem was to remove all submodules and then reinstall them.
如果它对其他人有帮助,我刚刚遇到了同样的问题,并发现在项目根目录中运行 git init 修复了它。
In case it helps anyone else, I just encountered the same issue and found that running
git init
in the project root fixed it.您的 git 项目(或至少一个子模块,如果有的话)已损坏。这意味着您的 .git 文件夹中的某些文件已损坏或丢失。
修复 git-repo
正如 Jordan 提到的:转到根目录并运行 git init。然后再次尝试
git status
。修复子模块
如果这不起作用,请导航到您的子模块文件夹并再次尝试
git init
。返回根目录并运行 git status。为什么它坏了?
一种答案可能是访问权限存在问题。也许您正在与多个用户一起处理工作副本?
另一个答案可能是某种同步软件,例如 OwnCloud、Dropbox、Google Drive 或像我这样的 BitTorrent Sync。我的工作副本位于同步文件夹中,该文件夹在我的工作计算机和家里的计算机之间同步。这会导致一些权限问题。
希望有帮助。
Your git-project (or at least one of your submodules, if you have some) became corrupted. This means that some of the files in your
.git
-folder(s) are corrupt or missing.Fix git-repo
As Jordan mentioned: Go to your root and run
git init
. Then trygit status
again.Fix submodules
If this doesn't work, navigate to your submodule-folder(s) and try
git init
again. Go back to root and rungit status
.Why is it broken?
One answer could be, that there are problems with the access-permissions. Maybe you're working with several users on the working copy?
Another answer could be some kind of sync-software like OwnCloud, Dropbox, Google Drive or like in my case BitTorrent Sync. My working copies are located in the sync-folder, which is synced between my computer at work and at home. This causes some issues with permissions.
Hope it helps.