Skip to content

When scanning Azure DevOps repo: "unable to get remote URL" "first path segment in URL cannot contain colon" #1747

@yuriy-sng

Description

@yuriy-sng

Describe the bug
Upon scanning a local Azure DevOps repo I encounter this error

To Reproduce

  • Clone an Azure DevOps repo via ssh
  • docker run -iv $(pwd):/path ghcr.io/gitleaks/gitleaks:latest git -v /path
  • Error:
$ docker run -iv $(pwd):/path ghcr.io/gitleaks/gitleaks:latest git -v /path

    ○
    │╲
    │ ○
    ○ ░
    ░    gitleaks

5:41PM FTL failed to scan Git repository error="unable to get remote URL: unable to parse remote URL:
 parse \"my_org@vs-ssh.visualstudio.com:v3/org/my_project/my_repo\": first 
path segment in URL cannot contain colon"

Expected behavior
The scanning starts

Basic Info (please complete the following information):

  • OS: Windows 10 -> WSL Ubuntu 22
  • Gitleaks Version: latest available at dockerhub (v8.23.3)

Additional context
If I print my git config, the URL part looks like this:

[remote "origin"]
        url = my_org@vs-ssh.visualstudio.com:v3/my_org/my_project/my_repo
        fetch = +refs/heads/*:refs/remotes/origin/*

This URL (with the ":v3") is expected, you can check Azure DevOps' docs: https://learn.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops#step-3-clone-the-git-repository-with-ssh

cc @zricethezav

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions