在 VirtualBox 上提交 Git - 错误:无法写入 sha1 文件名
我正在开发一个项目,需要我从我的主 Windows 机器在 VirtualBox 上运行 Ubuntu 作为开发服务器。我在 Windows 和 Ubuntu VBox 之间有一个共同的共享文件夹。该项目是用 Yii PHP 构建的,我主要负责前端代码。 Git 安装在 Ubuntu 上,我能够成功地从项目的 github 存储库中拉取。然而,当我尝试提交到 git 时,问题就出现了。
当我输入命令“git add -A”时,出现以下错误:
error: unable to write sha1 filename
.git/objects/e6/54703eed28d60e6f607eda24ffd2048bca83a6: Text file busy
error: framework/i18n/data/ne_np.php: failed to insert into database
error: unable to index file framework/i18n/data/ne_np.php
fatal: updating files failed
我尝试了很多解决方法,包括命令:
git config --add core.shareRepository group
但我最终也遇到了类似的错误。
有谁知道可能是什么原因造成的? 谢谢。
I am working on a project that requires me to run Ubuntu as a dev server on VirtualBox from my main Windows machine. I have a common shared folder between Windows and Ubuntu VBox. The project is built in Yii PHP, and I work mostly on the front-end code. Git is installed on Ubuntu and I am able to successfully pull from the project's github repository. However, the problem lies when I try to commit to git.
When I type the command "git add -A", I get the following error:
error: unable to write sha1 filename
.git/objects/e6/54703eed28d60e6f607eda24ffd2048bca83a6: Text file busy
error: framework/i18n/data/ne_np.php: failed to insert into database
error: unable to index file framework/i18n/data/ne_np.php
fatal: updating files failed
I have tried many work-arounds, including the command:
git config --add core.shareRepository group
But I also end up with a similar error.
Does anyone have any idea of what could be causing this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Dropbox 这样的同步文件夹中使用 git ,或者这通常是一个坏主意 - git 似乎假设没有其他人尝试同时触摸存储库,不会尝试执行集合文件系统操作的原子性,你会得到这样的竞争条件。
不要将 git 存储库放入自动同步的文件夹中。通过推送/拉取到 github 分支来同步主机和虚拟机。
Using
git
in synchronised folders like Dropbox or this is generally a bad idea –git
seems to assume that nobody else tries to touch a repo concurrently, doesn't try to perform sets of filesystem operations atomically, and you get race conditions like this.Don't put git repos into automatically synced folders. Synchronise the host and the VM by pushing/pulling to your github fork.
不要尝试共享您的存储库。对虚拟机和 Windows 主机进行彻底检查。 Git 并不是为了这样共享而设计的。
Do not try to share your repository. Do a clean checkout on the VM and Windows host. Git is not designed to be shared like this.