Repository navigation
Closed
Description
SshClient::isSshUrl() (
pitmaster/src/Protocol/SshClient.php
Lines 28 to 32 in 5beb97d
| public static function isSshUrl(string $url): bool | |
| { | |
| return str_starts_with($url, 'ssh://') | |
| || preg_match('/^[^@]+@[^:]+:.+$/', $url) === 1; |
^[^@]+@[^:]+:.+$ as SCP-style SSH. An HTTPS URL with credentials and a port matches that pattern:
SshClient::isSshUrl('https://[email protected]:8443/repo.git'); // true
SshClient::isSshUrl('https://[email protected]/u/r.git'); // falseclone(), fetch(), and push() pick the transport with this check (
Lines 264 to 269 in 5beb97d
| private static function uploadPackTransport(string $url): UploadPackTransport | |
| { | |
| return SshClient::isSshUrl($url) | |
| ? new SshClient() | |
| : new SmartHttpClient(); | |
| } |
Lines 4876 to 4892 in 5beb97d
| private function uploadPackTransport(string $url): UploadPackTransport | |
| { | |
| $this->assertNetworkOperationAllowed('fetch'); | |
| return SshClient::isSshUrl($url) | |
| ? new SshClient() | |
| : new SmartHttpClient(); | |
| } | |
| private function receivePackTransport(string $url): ReceivePackTransport | |
| { | |
| $this->assertNetworkOperationAllowed('push'); | |
| return SshClient::isSshUrl($url) | |
| ? new SshClient() | |
| : new SmartHttpClient(); | |
| } |
Expected
URLs with a scheme (https://, http://, git://, file://) are never treated as SCP-style SSH. git applies the SCP syntax only when there is no :// before the first colon.
Metadata
Metadata
Assignees
Labels
No labels
Activity