How can we improve Azure DevOps?

Add Git pre-receive hooks

This suggestion is migrated to Developer Community. Please use below link to view the current status.
Add built-in Git pre-receive hooks to block undesirable commits from the repository. Examples include commit messages, file content scanning, and file names.

135 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

AdminVSTS Team (Product group, Microsoft Visual Studio) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • D I commented  ·   ·  Flag as inappropriate

    Please add this! The lack of pre-receive hooks are making us seriously consider moving to Bitbucket server because we need to lock commits to a certain directory.

  • Navin commented  ·   ·  Flag as inappropriate

    It would be great if we have some UI based Git Pre-recevie hooks option like Branch policies( which is great option in Azure Devops)

  • Maciek Samsel commented  ·   ·  Flag as inappropriate

    Well it is not about just teaching people. People allowed slopiness pay least attention to process administration in development and they tend to create "their own ways" instead of following process established for commercial business. Also hooks are needed to enforce providing some information (comments, ticket number e.t.c.) that are critical to integrate with other tools (JIRA, Criucible e.t.c.)

  • John Goodwin commented  ·   ·  Flag as inappropriate

    Since VSTS promotes the shared repo model ( no forks ), having pre-commit hooks would let me stop large files from coming into the repo, or a single commit too large. For some reason this is too hard to teach people, so I'd rather just make the server return an error.

  • Dave Ferguson commented  ·   ·  Flag as inappropriate

    Another would be enforcing naming conventions for branching (lower case always to prevent casing issues, prefixing with a set of folder names such as feature or release or hotfix, etc).

  • Sid M commented  ·   ·  Flag as inappropriate

    I agree with yann Armand. We'd love to have pre-receive hooks to include logic to fix problems early on...

  • yann Armand commented  ·   ·  Flag as inappropriate

    We'd love to have pre-receive hook to detect secrets being pushed.
    We can use CredScan to detect them, but this is a build step, when it runs and detect the secrets, it is already too late, the secret is already present into the git history on VSTS server.

  • Anonymous commented  ·   ·  Flag as inappropriate

    I'd love to use pre-receive for clang-format to reject inconsistent formatting on the server side (paired with pre-commit on the client).

  • Anonymous commented  ·   ·  Flag as inappropriate

    We used to have update server hooks to check commit message should have work item id and I'd should exist in TFS otherwise reject the push.

  • Jakub Bereżański commented  ·   ·  Flag as inappropriate

    One thing I used a pre-receive hook for in the past (before we moved to TFS) was to ensure that users had their and set correctly, e.g. FirstName LastName and matching work e-mail. I'd be glad to be able to reproduce that functionality in TFS.

Feedback and Knowledge Base