为什么GIT没有检测到文件模式644和664之间的区别? [英] Why GIT does not detect the difference between the file mode 644 and 664?

查看:240
本文介绍了为什么GIT没有检测到文件模式644和664之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么GIT没有检测到文件模式644和664之间的差异,但检测到755:

  $:〜 / docker / images / php_cron / config $ ls -l crontab 
-rw -r - r-- 1 saf staff 4663 31 Dez 09:38 crontab

$:〜/ docker / images / php_cron / config $ chmod 664 crontab
$:〜/ docker / images / php_cron / config $ ls -l crontab
-rw-rw -r-- 1个saf staff 4663 31 Dez 09:38 crontab
$ b $:〜/ docker / images / php_cron / config $ git status
在分支上komplett-modularisiert
你的分支是'origin / komplett- modularisiert。

没有提交,工作目录干净
$:〜/ docker / images / php_cron / config $ chmod 755 crontab

$:〜/ docker / images / php_cron / config $ git status
在分支上komplett-modularisiert
你的分支是'origin / komplett-modularisiert'的最新版本。



不会为commit提交更改:
(使用git add< file> ...更新将提交的内容)
(使用git checkout - < file> ...放弃工作目录中的更改)

修改:crontab

没有更改添加到提交中(使用git添加和/或git commit -a)

我希望GIT检测任何类型的文件模式改变。当我通过git将我的文件放在一台服务器上,而这些服务器上的文件模式与我的存储库中的文件模式不同时,我得到了一些问题。 >我以前遇到过这个问题,而且没有解决方案。
唯一的办法是在将代码推送到服务器时保存权限。从服务器拉取代码时恢复文件的权限。
我写过一个脚本来完成这项工作,您可以参考以下网址: sr-perm


Why GIT does not detect the difference between the file mode 644 and 664, but 755 it detects:

$:~/docker/images/php_cron/config$ ls -l crontab 
-rw-r--r--  1 saf  staff  4663 31 Dez 09:38 crontab

$:~/docker/images/php_cron/config$ chmod 664 crontab 
$:~/docker/images/php_cron/config$ ls -l crontab 
-rw-rw-r--  1 saf  staff  4663 31 Dez 09:38 crontab

$:~/docker/images/php_cron/config$ git status
On branch komplett-modularisiert
Your branch is up-to-date with 'origin/komplett-modularisiert'.

nothing to commit, working directory clean
$:~/docker/images/php_cron/config$ chmod 755 crontab 

$:~/docker/images/php_cron/config$ git status
On branch komplett-modularisiert
Your branch is up-to-date with 'origin/komplett-modularisiert'.



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:   crontab

no changes added to commit (use "git add" and/or "git commit -a")

I would like that GIT detects any kind of file mode changes. I got issues when I deployed by git pulling my files on a server on which they had different file modes than in my repository.

解决方案

I had met this problem before, and there is no solution for it. The only way is to save the permissions when push the code to server. And restore the permission to the files when pull the code from server. I had written one script to do this work, you can refer to the url: sr-perm

这篇关于为什么GIT没有检测到文件模式644和664之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆