gitgithooksdvc

How to disable DVC git hooks


DVC has Git hooks which are installed with dvc install. The hooks were working fine but after an error with dvc push and the DVC remote, I cannot git push because before git push gets executed, dvc push runs and generates an error. Which means I can't push.

How can I disable DVC Git hooks so that I won't face the issue anymore?


Solution

  • All installed git hooks will be inside .git/hooks. Your problem is with the pre-push hook:

    $ ls .git/hooks
    applypatch-msg.sample      post-checkout          pre-commit               pre-push               pre-push.sample     prepare-commit-msg.sample
    commit-msg.sample          post-update.sample     pre-commit.sample        pre-rebase.sample   update.sample
    fsmonitor-watchman.sample  pre-applypatch.sample  pre-merge-commit.sample  pre-receive.sample
    

    Remove that and you will be fine:

    $ rm -rf .git/hooks/pre-push
    

    Note that other hooks like dvc checkout for git checkout still work. If you want to disable all hooks, not just dvc-installed, you can run:

    $ rm -rf .git/hooks/*