文件权限变更后的 Git 配置

2017-05-12  本文已影响930人  申申申申申

某些时候修改了文件权限后,git status 会发现许多文件都发生了变化

tianqingsedengyanyu:qifa fengfeng$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   app/admin/control/login.php
        modified:   app/member/control/connect_sms.php
        modified:   temp/cache/adv/index.html
        modified:   temp/cache/index.html
        modified:   temp/cache/index/index.html
        modified:   temp/cache/phpqrcode/index.html
        modified:   temp/cache/rec_position/index.html
        modified:   temp/session/index.html

no changes added to commit (use "git add" and/or "git commit -a")
tianqingsedengyanyu:qifa fengfeng$ 

查看文件修改

tianqingsedengyanyu:qifa fengfeng$ git diff temp/cache/phpqrcode/index.html
diff --git a/temp/cache/phpqrcode/index.html b/temp/cache/phpqrcode/index.html
old mode 100644
new mode 100755
tianqingsedengyanyu:qifa fengfeng$ 

因为修改了项目权限 chmod -R 777 /Users/fengfeng/Desktop/bbc

使用git忽略掉权限变化

.git/config => filemode = false

tianqingsedengyanyu:qifa fengfeng$ vim .git/config 

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
[remote "origin"]
        url = http://1**.224.27.8:88/****_team/***.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        pushurl = http://1**.224.27.8:88/****_team/***.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "dev"]
        remote = origin
        merge = refs/heads/dev

再次查看

tianqingsedengyanyu:qifa fengfeng$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   app/admin/control/login.php
        modified:   app/member/control/connect_sms.php

no changes added to commit (use "git add" and/or "git commit -a")
tianqingsedengyanyu:qifa fengfeng$ 

 不定期更新 不合适的地方 还请指点~ 感激不尽
上一篇下一篇

猜你喜欢

热点阅读