Add instructions how to bypass nokeycheck
If git cl upload fails due to a private key being detected,
print more useful message for git-cl users.
R=aravindvasudev@google.com
Fixed: 1201742
Change-Id: Ida5c9c9788058dc17c1c50034c9b0b8831cfbd20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3453203
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/git_cl.py b/git_cl.py
index 74f04d9..7222404 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2289,6 +2289,17 @@
'git cl upload -o uploadvalidator~skip\n\n'
'If git-cl is not working correctly, file a bug under the '
'Infra>SDK component.')
+ if 'git push -o nokeycheck' in str(e.stdout):
+ raise GitPushError(
+ 'Failed to create a change, very likely due to a private key being '
+ 'detected. Please examine output above for the reason of the '
+ 'failure.\n'
+ 'If this is a false positive, you can try to bypass private key '
+ 'detection by using push option '
+ '-o nokeycheck, e.g.:\n'
+ 'git cl upload -o nokeycheck\n\n'
+ 'If git-cl is not working correctly, file a bug under the '
+ 'Infra>SDK component.')
raise GitPushError(
'Failed to create a change. Please examine output above for the '