git - 如何在 Azure/VSO 中启用/禁用 secret 扫描

标签 git azure azure-devops azure-pipelines git-commit

在VSO中,我尝试过在不获取最新版本的情况下推送代码,什么时候,我的代码被推送到本地了。当我尝试再次推送到中央存储库时提取最新代码后,出现以下错误。 我在几个文件中有凭据,删除它后我也遇到了同样的错误。 任何帮助将不胜感激,提前致谢......!!!

If these are valid credentials, even for non-production resources, you must remove them from Git’s branch history by resetting your branch or squashing all commits. See https://aka.ms/1escredscan for instructions. Please report any false positives to [email protected].

NOTE: It is not enough to remove the secrets and push another change. You must reset your branch according to the instructions.

If this is a false positive, you can bypass credential scanning (for this push alone) by running these commands, assuming that you have no staged changes:

git commit -m "**DISABLE_SECRET_SCANNING**" --allow-empty`
git push

Alternatively, see https://aka.ms/1escredscan for instructions on how to use the hash values emitted above in a suppressions file to suppress false positives.) failed to push some refs to 'https://DevRepository'

Error encountered while pushing to the remote repository: rejected Dev -> Dev (VS403654: The push was rejected because it might contain credentials or other secrets.

最佳答案

I had credentials in few files, after removing it also I'm getting the same error

这将在这些凭据消失的地方创建一个新的提交。
但所说的凭据仍然存在于过去的提交中。

您需要remove that sensitive data ,可能有 git filter-branch --tree-filterBFG Repo-Cleaner .

然后强制推送。

As per the suggestion, it says run this command to disable "git commit -m "DISABLE_SECRET_SCANNING" --allow-empty git push" but how do I enable back?

我认为带有消息“DISABLE_SECRET_SCANNING”的提交意味着不扫描该提交之后的敏感数据(即在较旧的提交中)。
但我假设扫描仍然针对较新的提交完成,因此您不必担心“重新启用它”。

关于git - 如何在 Azure/VSO 中启用/禁用 secret 扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54325800/

相关文章:

Git:当我没有修改它们时,差异中会出现大量空白行

git checkout 尝试检查提交而不是分支

git - 获取 git 当前分支/标签名称

Azure DNS 转发器无法使用公共(public)资源

javascript - 创建包含集合中所有 Azure 团队项目的下拉列表

git - 如何删除 Git 存储库中的多个已删除文件

azure - UserErrorSqlBulkCopyInvalidColumnLength - Azure SQL 数据库

azure - 在 Azure Datalake 中读取和编辑大型文本文件

c# - 为什么我在使用个人访问 token 时收到授权错误?

azure - 使用幂等 ARM TEMPLATE 将两个 Azure 应用服务部署到同一应用服务计划