Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 已签名的powershell脚本在源代码管理后未签名_Git_Powershell_Version Control_Code Signing - Fatal编程技术网

Git 已签名的powershell脚本在源代码管理后未签名

Git 已签名的powershell脚本在源代码管理后未签名,git,powershell,version-control,code-signing,Git,Powershell,Version Control,Code Signing,我正在尝试设置一些powershell构建脚本。我有一个自签名证书,可以用来对脚本进行签名,并使其与AllSigned一起运行。问题是,这并没有贯穿我们的scm(git) 每当我尝试克隆并运行脚本,或更改脚本并还原时,都会出现文件未签名的错误 File <> cannot be loaded. The file <> is not digitally signed. The script will not execute on the system. ... 无法加载文

我正在尝试设置一些powershell构建脚本。我有一个自签名证书,可以用来对脚本进行签名,并使其与
AllSigned
一起运行。问题是,这并没有贯穿我们的scm(git)

每当我尝试克隆并运行脚本,或更改脚本并还原时,都会出现文件未签名的错误

File <> cannot be loaded. The file <> is not digitally signed. The script will not execute on the system. ...
无法加载
文件。该文件未进行数字签名。脚本将不会在系统上执行。。。
如果我对脚本重新签名,签名块将更改,我可以再次运行它


有没有办法保留签名?

与源代码管理相关的内容正在修改脚本。例如,如果您正在使用Subversion,则通过
svn:keywords
扩展关键字,如
$Id
$URL$
,将导致脚本随每次修订而更改。另一种可能性是正在修改EOL标记或文件编码(UTF-8与ASCII)。

今天上午进一步探讨了这一点:

除了附加到实际文件的签名块外,还有作为文件扩展属性存储的签名信息

正如可以预料的那样,git不跟踪ea。对于权限等属性,标准建议是使用git挂钩。我无法找到任何方法来设置数字签名的属性,而无需重新签名文件

剩下3个选项:

  • 将生成服务器和需要运行脚本的任何其他计算机切换到
    RemoteSigned
  • 使用一些shell voodoo、git钩子,并在每次删除属性时对文件重新签名。脆弱而粗糙
  • 重做构建/部署过程,以便不需要powershell脚本。我还处于早期阶段,所以这是我最好的选择

即使恢复到文件的已提交、已签名版本(EOL标记相同),也会出现问题。根本原因是某些签名信息存储为扩展属性,git无法跟踪。