ggshield invocation during git commit

Prasad Khalane 25 Reputation points
2026-07-24T13:18:54.55+00:00

In VS 2019, ggshield gets invoked automatically while making commits, and it blocks commit if secret is present in any file.

But this is not happening with Visual Studio 2022, because it uses it's own mini git version.

I am not able change VS 2022 setting to use windows default git. How to integrate that pre-commit hook of ggsheild in VS 2022.

Developer technologies | Visual Studio | Setup

1 answer

Sort by: Most helpful
  1. Nancy Vo (WICLOUD CORPORATION) 8,075 Reputation points Microsoft External Staff Moderator
    2026-07-27T04:39:21.75+00:00

    Hello @Prasad Khalane ,

    Thanks for your question.

    Visual Studio 2022 uses its own internal Git and no longer has the option to switch to the system Git. To make the ggshield pre-commit hook work, I recommend installing it directly so the internal Git recognizes it.

    You can refer to the following steps:

    • Open your command line terminal.
    • Navigate to your project folder and run ggshield install --mode local to set it up for that specific repository.
    • Alternatively, run ggshield install --mode global to apply it to all repositories on your computer.
    • Ensure ggshield is added to your Windows system PATH so the built-in Git can find it.
    • Run ggshield auth login to authenticate if you have not done so already.

    For more details on the installation commands, you can view the official documentation directly here.

    While this is a non-Microsoft link, it’s official Gitguardian documentation and is safe to visit.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback. Thank you.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.