V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
FaiChou
V2EX  ›  程序员

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

  •  
  •   FaiChou ·
    FaiChou · 2017-10-09 09:13:46 +08:00 · 4638 次点击
    这是一个创建于 2384 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

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

    18 条回复    2017-10-10 04:40:26 +08:00
    atan
        1
    atan  
       2017-10-09 09:16:16 +08:00   ❤️ 4
    git config core.filemode false
    FaiChou
        2
    FaiChou  
    OP
       2017-10-09 09:18:28 +08:00
    @atan 谢谢 可以了
    lcdtyph
        3
    lcdtyph  
       2017-10-09 09:19:51 +08:00 via iPhone
    一言不合就 777 …
    monsterxx03
        4
    monsterxx03  
       2017-10-09 09:40:26 +08:00   ❤️ 2
    神烦碰到问题无脑 sudo,无脑 777 的,以后要吃大亏
    GOOD21
        5
    GOOD21  
       2017-10-09 09:54:31 +08:00
    @monsterxx03 还有无脑 rm 的
    motecshine
        6
    motecshine  
       2017-10-09 09:59:38 +08:00
    是什么需求 让你 chmod 777 文件
    FaiChou
        7
    FaiChou  
    OP
       2017-10-09 10:08:56 +08:00
    @motecshine git unpack failed unable to create temporary object directory
    SilentDepth
        8
    SilentDepth  
       2017-10-09 10:40:21 +08:00
    777 就罢了,为什么要 -R
    FaiChou
        9
    FaiChou  
    OP
       2017-10-09 11:01:53 +08:00
    @SilentDepth recursively
    SilentDepth
        10
    SilentDepth  
       2017-10-09 11:13:22 +08:00
    @FaiChou #9 我知道 -R 是什么作用,我是说只修改根目录的属性不行吗?
    raphaelsoul
        11
    raphaelsoul  
       2017-10-09 11:14:18 +08:00
    777 艺高人胆大
    FaiChou
        13
    FaiChou  
    OP
       2017-10-09 11:31:55 +08:00
    @SilentDepth 哈,其实我也知道你是知道-R 作用的。我只是想回答 我就是想递归修改子路径下文件,彻底一点,因为我不想查到哪个路径下哪个文件权限问题导致推送失败,所以索性都改了。作为前端开发,改权限应该不是忌讳的吧?都忌讳无脑 rm 无脑 777 无脑 cv。。。其实忌讳的是无脑,而不是某个命令吧。
    SilentDepth
        14
    SilentDepth  
       2017-10-09 11:40:15 +08:00
    改权限的忌讳跟前端有啥关系…… temporary object directory,难道不是在 .git 目录下吗?改根目录属性,至多加上 .git
    FaiChou
        15
    FaiChou  
    OP
       2017-10-09 12:00:52 +08:00 via iPhone
    @SilentDepth 问题已解决,感谢回复
    zsj950618
        16
    zsj950618  
       2017-10-09 13:28:59 +08:00 via Android
    害人不浅,毁人不倦,2333
    sampeng
        17
    sampeng  
       2017-10-09 17:49:30 +08:00
    无脑 777 都是网上各种复制粘贴的教程闹的
    msg7086
        18
    msg7086  
       2017-10-10 04:40:26 +08:00 via Android
    没权限是 owner 闹的吧,改 mode ?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2743 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 12:53 · PVG 20:53 · LAX 05:53 · JFK 08:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.