查看文件权限

git ls-files --stage
100644 f23de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       test.sh

说明:

644权限,默认不能执行 后面没有加文件。会查询当前目录和子目录下所有文件的权限情况

查看单文件权限

git ls-files --stage test.sh
100644 f23de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       test.sh

给文件加权限

git update-index --chmod +x test.sh

说明:

加+x表示增加执行权限