No, it won't bypass any pushes or commits in the near future, unless:

  1. You have an alias that adds this by default within your .gitconfig
  2. You pass this flag every time you push or commit.

Regarding the second point, you need to pass --no-verify every time for this to work.

Option 1 Example

.gitconfig

Adding an alias to your git config (i.e. fcommit for force commit) would apply the --no-verify everytime.

[alias]
        fcommit = commit --no-verify

Usage

git fcommit
Answer from steadweb on Stack Overflow
🌐
GitHub
github.com › cli › cli › issues › 684
Is there a way to pass --no-verify when creating a PR? · Issue #684 · cli/cli
March 19, 2020 - Sometimes I would like to be able to create a PR without running the pre-commit and commit-msg pre-push hooks when pushing the changes. Is that possible? Edit: Replaced pre-commit and commit-msg with pre-push.
Author   CExWHamdan
Discussions

git push --no-verify should be configurable
What would you like Renovate to be able to do? By default, since #6521, renovate runs git push with the option --no-verify. This skips any pre-push hooks, as well as hooks on the receiving end. It ... More on github.com
🌐 github.com
11
April 21, 2021
Is there any way of knowing if a commit was pushed with "--no-verify"
My company's solution to this is to repeat our hooks in CI. It doesn't confirm that the commit was made correctly, but it at least confirms that the current state is the repo isn't breaking any of the rules the hooks are there to enforce. More on reddit.com
🌐 r/git
13
9
April 13, 2021
Doing `git push --no-verify` instead of `git push --set-upstream origin`
Hi, I've installed thefuck and when I do git push and it says to do git push --set-upstream..., when I do fuck it does git push --no-verify instead of the whole git push --set-upstream origin f... More on github.com
🌐 github.com
8
September 27, 2021
--no-verify for git push
Add a key binding to pass --no-verify to git push, to bypass pre-push hook. If you point me to the right place in the Magit sources, I can add it myself. More on github.com
🌐 github.com
3
January 30, 2014
🌐
GitHub
github.com › renovatebot › renovate › issues › 9673
git push --no-verify should be configurable · Issue #9673 · renovatebot/renovate
April 21, 2021 - This skips any pre-push hooks, as well as hooks on the receiving end. It shouldn't be default to do this, since people might have important checks that maintain their repo integrity.
Author   fgblomqvist
🌐
Git
git-scm.com › docs › git-push
Git - git-push Documentation
Alternatively, specifying ... are integrated locally before allowing a forced update. ... Usually, git push will refuse to update a branch that is not an ancestor of the commit being pushed....
🌐
Reddit
reddit.com › r/git › is there any way of knowing if a commit was pushed with "--no-verify"
r/git on Reddit: Is there any way of knowing if a commit was pushed with "--no-verify"
April 13, 2021 -

I know ideally you shouldn't commit with "--no-verify", and we all know there are cases where a fix must be pushed asap, and...welp you know the drill. We're going through some serious changes in our project and cases like this have happened every so often, and we'd like to come up with a protocol to make sure any commit that has skipped the pre-commit should be fixed asap. The first idea that came to mind was some way of flagging a merge request that has any commit that has been pushed with "--no-verify", but ideas are very welcome!

Don't know if this helps but we're hosting our repo in gitlab.

edit: dropped a question mark in the title, sorry

🌐
npm
npmjs.com › package › git-push-no-verify
git-push-no-verify - npm
April 1, 2020 - A simple console tool to bypass husky check on push. Latest version: 1.0.0, last published: 6 years ago. Start using git-push-no-verify in your project by running `npm i git-push-no-verify`. There are no other projects in the npm registry using git-push-no-verify.
      » npm install git-push-no-verify
    
Published   Apr 01, 2020
Version   1.0.0
Author   Dima Snisarenko
Find elsewhere
🌐
Atlassian
jira.atlassian.com › browse › SRCTREEWIN-1353
Add --no-verify option to git commit | Sourcetree for Windows
When doing a commit, I would like to be able to ignore errors from my pre-commit script. At the command line this is done by adding the --no-verify flag.
🌐
DEV Community
dev.to › annihil › comment › hhg6
I personally use git push origin master --force --no-verify - DEV Community
November 10, 2019 - I personally use git push origin master --force --no-verify · Troy Witthoeft · Troy Witthoeft · Troy Witthoeft · Follow · Joined · Nov 2, 2019 • Nov 10 '19 • Edited on Nov 10 • Edited · Copy link · Hide · Monster images.app.goo.gl/cJhp4uT7jW24EqsZ8 ·
🌐
Graphite
graphite.com › guides › git-commit--no-verify
How to use `git commit --no-verify` - Graphite
Using --no-verify also bypasses these checks. To commit changes without running pre-commit hooks, use: ... This command commits the current staged changes to the repository with the provided commit message, skipping any hooks.
🌐
GitHub
github.com › nvbn › thefuck › issues › 1238
Doing `git push --no-verify` instead of `git push --set-upstream origin` · Issue #1238 · nvbn/thefuck
September 27, 2021 - ➜ main git:(feature/CUXP-1111-bulk-upload) ✗ git push fatal: The current branch feature/CUXP-1111-bulk-upload has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin feature/CUXP-1111-bulk-upload ➜ main git:(feature/CUXP-1111-bulk-upload) ✗ fuck git push --no-verify [enter/↑/↓/ctrl+c]
Author   Albion31
🌐
Super User
superuser.com › questions › 1518316 › can-i-push-a-commit-with-no-verify-from-git-gui
bash - Can I push a commit with "--no-verify" from git gui? - Super User
January 18, 2020 - I want to commit some files with a suggestive title, but I can not find a no-verify option.I know that I can do it in bash by simply adding "--no-verify" as a parameter but it would be ea...
🌐
GitHub
github.com › magit › magit › issues › 1180
--no-verify for git push · Issue #1180 · magit/magit
January 30, 2014 - Add a key binding to pass --no-verify to git push, to bypass pre-push hook. If you point me to the right place in the Magit sources, I can add it myself.
Author   swsnr
Top answer
1 of 4
26

First off: you can't definitively prevent someone from passing the --no-verify option. That said, it's a good practice to use pre-commit hooks for linting, and it's a good practice to avoid passing the --no-verify option without reason.

If, however, you want to make it more cumbersome to pass the --no-verify option, you could:

  1. generate a verification token and append it to the commit message in pre-commit;
  2. exit pre-receive with a non-zero exitcode if this token is missing or invalid. (Examples of things you can do in pre-receive hooks: https://github.com/github/platform-samples/tree/master/pre-receive-hooks)

Someone determined to avoid passing --no-verify could manually do step 1, which is why this isn't 100% effective. I wouldn't recommend setting this up in a professional context, but I'm all for people using the tools at their disposal to instill good habits for themselves, while learning more about git hooks.

2 of 4
5

git hooks are a client-side validation (think of it as a frontend), if you want to be sure validation is never skipped you need to do it on CI (backend).


Having said that here's my personal opinion about git hooks: it's a good practice to prevent devs to merge a PR in case linter, tests, etc don't pass. But do it on CI, don't enforce it prematurely on the client side. It will unnecessarily slow down the development process. Allow devs to decide when they want to fix linter issues instead of saying "you can't commit until you make it perfect". That will allow them to focus on solving the problem they are working on instead of having to think in code style standards

🌐
Stephenlewis
stephenlewis.me › blog › git-push-no-hooks
How to Bypass The Git Pre-Push Hook
March 22, 2022 - Git’s pre-push hooks are a great way to enforce code quality. They’re also a pain when you just want to push some in-progress work to a branch. The --no-verify flag allows you to bypass the pre-push hook when pushing.
🌐
Adam Johnson
adamj.eu › tech › 2023 › 02 › 13 › git-skip-hooks
Git: How to skip hooks - Adam Johnson
February 13, 2023 - $ SKIP=check-added-large-files,check-copyright git commit -m "Add Pirates of the Caribbean 4k" For other hook managers, read their friendly docs. Here’s a hack for skipping hooks without a corresponding --no-verify option. Git loads hooks from your repository’s .git/hooks directory by default, but you can change this with the core.hooksPath.
🌐
Git Scripts
gitscripts.com › git-push-no-verify
Mastering Git Push No Verify: A Quick Guide
August 28, 2024 - Why it's implemented: It helps maintain code quality and ensures that all changes adhere to set standards. ... The `--no-verify` flag can be appended to the `git push` command to bypass any pre-push hooks defined in your repository.
🌐
GitHub
github.com › sindresorhus › np › pull › 299
feat: add --no-verify option to git push by harryparkdotio · Pull Request #299 · sindresorhus/np
Yeah, it kind of sucks having to open a terminal to push because of a broken git hook. ... I also need this feature. I'm using Husky for pre-commit hooks. But because Husky is installed as a DEV dependency, and as part of my publish I prune all DEV dependencies in the preversion hook. As a result, when np tries to commit the version change, it fails, because Husky is no longer there because it was cleaned up as part of pruning the DEV dependencies. So without the --no-verify option, I'm forced to have the Husky package included so that np can finish publishing.
Author   sindresorhus