Git 文件库执行了 chmod 操作后所有文件都变为 modified

2017 年 10 月 9 日
 ethusdt

由于某次项目推送失败,于是执行了一遍$sudo chmod -R 777 project。

于是项目中出现几百个 tracked/modified 文件,所有的项目文件都 modifed 了,包括.gitignore, .eslintrc, debug.log, README.md, allsrc.

改怎么处理? 删掉库重新 down 一遍吗

5225 次点击
所在节点    程序员
18 条回复
atan
2017 年 10 月 9 日
git config core.filemode false
ethusdt
2017 年 10 月 9 日
@atan 谢谢 可以了
lcdtyph
2017 年 10 月 9 日
一言不合就 777 …
monsterxx03
2017 年 10 月 9 日
神烦碰到问题无脑 sudo,无脑 777 的,以后要吃大亏
GOOD21
2017 年 10 月 9 日
@monsterxx03 还有无脑 rm 的
motecshine
2017 年 10 月 9 日
是什么需求 让你 chmod 777 文件
ethusdt
2017 年 10 月 9 日
@motecshine git unpack failed unable to create temporary object directory
SilentDepth
2017 年 10 月 9 日
777 就罢了,为什么要 -R
ethusdt
2017 年 10 月 9 日
@SilentDepth recursively
SilentDepth
2017 年 10 月 9 日
@FaiChou #9 我知道 -R 是什么作用,我是说只修改根目录的属性不行吗?
0x4b0082
2017 年 10 月 9 日
777 艺高人胆大
kukat
2017 年 10 月 9 日
chmod -R 777 Fix for everything
ethusdt
2017 年 10 月 9 日
@SilentDepth 哈,其实我也知道你是知道-R 作用的。我只是想回答 我就是想递归修改子路径下文件,彻底一点,因为我不想查到哪个路径下哪个文件权限问题导致推送失败,所以索性都改了。作为前端开发,改权限应该不是忌讳的吧?都忌讳无脑 rm 无脑 777 无脑 cv。。。其实忌讳的是无脑,而不是某个命令吧。
SilentDepth
2017 年 10 月 9 日
改权限的忌讳跟前端有啥关系…… temporary object directory,难道不是在 .git 目录下吗?改根目录属性,至多加上 .git
ethusdt
2017 年 10 月 9 日
@SilentDepth 问题已解决,感谢回复
zhsj
2017 年 10 月 9 日
害人不浅,毁人不倦,2333
sampeng
2017 年 10 月 9 日
无脑 777 都是网上各种复制粘贴的教程闹的
msg7086
2017 年 10 月 10 日
没权限是 owner 闹的吧,改 mode ?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://v2ex.xtra.eu.org/t/396058

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX