在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-filter
或BFG 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/