coder / coder/registry

bug: `git-clone` did not parse and add port to `ssh-keyscan` command

Open
#1,073 1 comment 1 reaction 1 assignee Claimed by @35C4n0r View on GitHub
Dominant language
HCL
Stars
79
Forks
161
Avg merge
1d 10h
Merged PRs (30d)
38

Description

## Issue
PR https://github.com/coder/registry/pull/942 add feature to add repo url to known host, but it only parse the host and did not parse the port when running `ssh-keyscan` command. This make the known host added for port 22 instead.

My use case is using self hosted gitea/forgejo, because port 22 already used by the host for ssh into the host machine I use port 2222 instead for the git ssh. The repo URL is something like this:
```
ssh://git@forgejo.domain.tld:2222/LazyGeniusMan/test-repo.git
```

The current parsing is :
https://github.com/coder/registry/blob/6be121e4f6eabd2f248cb9c81953af4c95457634/registry/coder/modules/git-clone/run.sh#L56

The result for repo URL above is : `forgejo@domain.tld`

Then the value used in:
https://github.com/coder/registry/blob/6be121e4f6eabd2f248cb9c81953af4c95457634/registry/coder/modules/git-clone/run.sh#L64

## Proposed Fix
1. Parse the port from ssh repo url
2. Pass the `-p` arg to `ssh-keyscan` command

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.