8000 Git Fetch does not work with Azure DevOps repos · Issue #1058 · src-d/go-git · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Git Fetch does not work with Azure DevOps repos #1058
Open
@jessesuen

Description

@jessesuen

We use go-git in our K8s GitOps Deployment tool and users are reporting issues with Azure DevOps git repos. It appears that go-git does not work with Azure DevOps git repos. Fetch fails with the following error:
unexpected client error: unexpected requesting "https://jsuen0437@dev.azure.com/jsuen0437/jsuen/_git/jsuen/git-upload-pack" status code: 400

The go-git call we are making are as follows:

	err = repo.Fetch(&git.FetchOptions{
		RemoteName: git.DefaultRemoteName,
		Tags:       git.AllTags,
		Force:      true,
	})

The equivalent git CLI command will succeed git fetch origin --tags --force.

I traced the error down to the upload_pack.go::UploadPack() when it is making the HTTP request:

func (s *upSession) UploadPack(
	ctx context.Context, req *packp.UploadPackRequest,
) (*packp.UploadPackResponse, error) {

	if req.IsEmpty() {
		return nil, transport.ErrEmptyUploadPackRequest
	}

	if err := req.Validate(); err != nil {
		return nil, err
	}

	url := fmt.Sprintf(
		"%s/%s",
		s.endpoint.String(), transport.UploadPackServiceName,
	)

	content, err := uploadPackRequestToReader(req)
	if err != nil {
		return nil, err
	}

	res, err := s.doRequest(ctx, http.MethodPost, url, content)  // <<<<< fails here
	if err != nil {
		return nil, err
	}
...
}

The values to the doRequest() call are:

url: https://jsuen0437@dev.azure.com/jsuen0437/jsuen/_git/jsuen/git-upload-pack
content: 004cwant 58594acf362b1452349e2a15163d3357b9160663 side-band-64k no-progress
00000009done

I tested with the following go-git versions:

  • v4.7.0
  • v4.9.1

EDIT: updated to note that this fails even with public repos. Please feel free to use:
https://jsuen0437@dev.azure.com/jsuen0437/jsuen/_git/jsuen for testing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0