Aman
Aman

Reputation: 263

How to do git checkout on Azure pipeline over HTTP/2?

I need to set git checkout on HTTP/2. However, I am unable to find any such option and Azure is exclusively setting the http.Version to HTTP/1.1 and this is blocking my checkout due to firewalls. Any help or workaround on how I can set http.Version to HTTP/2 is appreciated. Thank you.

Below is the snapshot of pipeline logs.

enter image description here

This is my pipeline yaml

 pool:
  name: "some pool"

trigger:
- some branch

stages:
- stage: main
  jobs:
  - job: synchronize
    steps:
    - checkout: self
      clean: true
      displayName: Git checkout
      continueOnError: true
    - task: Bash@3
      inputs:
        targetType: filePath
        filePath: $(System.DefaultWorkingDirectory)/scripts/sync_git.sh
        workingDirectory: $(System.DefaultWorkingDirectory)

I am running azp agents as container in Kubernetes.

Upvotes: 0

Views: 525

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41555

You can't configure the http.version in the Checkout step. Microsoft force to use HTTP/1.1, you can see it in the Microsoft agent source code:

// Force Git to HTTP/1.1. Otherwise IIS will reject large pushes to Azure Repos due to the large content-length header
// This is caused by these header limits - https://learn.microsoft.com/en-us/iis/configuration/system.webserver/security/requestfiltering/requestlimits/headerlimits/
int exitCode_configHttp = await gitCommandManager.GitConfig(executionContext, targetPath, "http.version", "HTTP/1.1");
if (exitCode_configHttp != 0)
{
    executionContext.Warning($"Forcing Git to HTTP/1.1 failed with exit code: {exitCode_configHttp}");
}

As workaround, you can disable the native checkout step with checkout: none and implement a custom checkout. just add a command line task and perform git commands:

git config http.version HTTP/2
git clone YOUR-REPO-URL

Upvotes: 3

Related Questions