---
name: is_git_repo_url
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "def is_git_repo_url(url: str, known_hosts: list[str] | None = None) -> bool"
description: "Verifica si una URL apunta a un repositorio git clonable. Acepta org/repo y org/repo/tree/<ref>. Rechaza issues, blobs, PRs y otros sub-recursos."
tags: [git, url, validation, github, gitlab, repository, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [urllib.parse]
params:
  - name: url
    desc: "URL del repositorio de código a validar (HTTPS, HTTP, SSH)"
  - name: known_hosts
    desc: "Lista opcional de hosts conocidos para validar URLs SSH"
output: "True si la URL apunta a un repositorio clonable, False en caso contrario"
tested: true
tests:
  - "URL repo valida"
  - "URL de issue (False)"
  - "URL de blob/file (False)"
  - "URL con tree/branch (True)"
test_file_path: "python/functions/core/parse_git_url_test.py"
file_path: "python/functions/core/core.py"
---

## Ejemplo

```python
is_git_repo_url("https://github.com/psf/requests")
# True

is_git_repo_url("https://github.com/psf/requests/issues/123")
# False

is_git_repo_url("https://github.com/psf/requests/blob/main/README.md")
# False

is_git_repo_url("https://github.com/psf/requests/tree/main")
# True

is_git_repo_url("git@github.com:psf/requests.git")
# True
```

## Notas

Funcion pura. Para SSH y git:// se acepta cualquier path siempre que el host sea conocido (los protocolos de clonacion no navegan a sub-recursos). Para HTTP/HTTPS se exige exactamente 2 segmentos (org/repo) o 4 segmentos con `tree` en posicion 3.
