Azure devops-服务器端git挂钩

时间:2019-01-16 08:36:12

标签: git tfs azure-devops azure-repos

我们如何实现服务器端挂钩或任何类似的解决方案,以将git push限制到git server中?

例如,我们要禁用推送包含* .class文件的提交。

3 个答案:

答案 0 :(得分:1)

我不认为Azure DevOps使用钩子。

您可以使用Branch Policies来使用外部验证服务(据我所知,它使用Web挂钩)。

其他:this User Voice请求的状态指示以上为正式答案。

但是也许简单的情况是.gitignore和代码审查?

答案 1 :(得分:1)

我要做的是将生成选项与Azure DevOps中的策略一起使用。这是我的azure-pipelines.yml文件:

---
trigger:
  branches:
    exclude:
      - '*'

pool:
  vmImage: 'ubuntu-latest'

steps:
  - script: sudo apt-get install python3-pip
    displayName: 'Install Python PIP'

  - script: sudo apt-get install python3-setuptools
    condition: succeeded()
    displayName: Install Python SetupTools

  - script: sudo pip3 install -r requirements.txt
    condition: succeeded()
    displayName: Install Python PIP Packages

  - task: PythonScript@0
    inputs:
      scriptSource: filePath
      scriptPath: hooks/lint_checker.py
      pythonInterpreter: python3
    condition: succeeded()
    displayName: Lint Checker

答案 2 :(得分:1)

使用分支策略并仅设置与PR的合并,在禁用直接推送到分支之后,您可以为某些用户(构建用户或管理员)跳过这些策略 enter image description here

相关问题