简体   繁体   中英

How to bypass the pre-receive hook for a single commit?

I want to push the code in java script to the remote repo on git, the repo contains per-recived hook that is scanning the code and I get the error that my code contains private key, after looking into it my code does not contain private key or any secret information. It only contains a word rsa-key that pre-receive hook sees as a threat and it does no allow me to push my code. Is there any solution how to skip scanning some java script files without using.gitignote, or changing anything in the code because that is not possible right now.

I tried:

git push --no-verify
# got the same error 
remote: [WARNING] You are trying to commit a password, token, private key or confidential information which is not allowed in our **** Git

A pre-receive hook is set on the server, and cannot be bypassed using only git options from the client side.


You may report an issue to the maintainers of the project, and have them update their hook so that your false positive doesn't get rejected anymore,
or perhaps find a workaround in your code to skip the check (eg: turn const tag = "rsa-key" into const tag = "rsa-"+"key" or some similar bad hack...)

You may also ask the maintainers (or, hopefully, read the repo's documentation...) for a way to give extra instructions to this pre-receive hook -- for example: a special keyword in the commit message ( skip-key-check ?) or a comment next to the incriminated line in your code ( //pre-receive-secret:skip ?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM