Skip to content

[Feat] Gitea/GitLab Custom SSH Ports#1096

Open
RichardAnderson wants to merge 4 commits into
vitodeploy:4.xfrom
RichardAnderson:feat/gitea-custom-port
Open

[Feat] Gitea/GitLab Custom SSH Ports#1096
RichardAnderson wants to merge 4 commits into
vitodeploy:4.xfrom
RichardAnderson:feat/gitea-custom-port

Conversation

@RichardAnderson
Copy link
Copy Markdown
Member

This pull request introduces support for configuring a custom SSH port for Gitea and GitLab source control providers, allowing users to specify which port should be used when cloning repositories. It also generalizes provider editability, so only safe, whitelisted fields can be edited, and ensures the UI and API reflect these changes. The most significant changes are grouped below.

Gitlab UI
CleanShot 2026-05-17 at 11 35 30
Gitea UI
CleanShot 2026-05-17 at 11 36 23

Backend: SSH Port Support and Provider Editability

  • Added ssh_port as a configurable and editable field for Gitea and GitLab providers, including validation, normalization, and persistence logic in their respective provider classes (Gitea.php, Gitlab.php). The default is 22, but users can specify a different port if needed.
  • Updated the abstract provider and interface to require implementation of getSshPort, editableFields, editRules, and editData methods, ensuring only whitelisted fields can be edited and preventing unsafe mass assignment.
  • The edit action now merges provider-specific rules and data handling, so only allowed fields are validated and saved.

UI/API: Dynamic Edit Forms and Schema Updates

  • The API resource and OpenAPI schema now conditionally include the ssh_port field for providers that support it, with proper typing and documentation.
  • The frontend edit form dynamically renders only the editable fields for each provider, using provider config and dynamic field components, ensuring the UI matches backend validation and security.
  • Registration and configuration of providers now include a list of editable fields, so the UI and backend remain in sync about what can be edited.

Operational: SSH Clone Script and Usage

  • The SSH clone script and logic now use the configured port when cloning repositories, and update ssh-keyscan and SSH config generation accordingly.

Provider Registration

  • When registering Gitea and GitLab providers, the SSH port field is included in their dynamic forms, with defaults and descriptions.

These changes make SSH port configuration safer, more flexible, and more user-friendly for self-hosted source control integrations.

Resolves #1085

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds configurable SSH clone ports for Gitea and GitLab source control providers and threads that configuration through backend provider data, clone script rendering, API resources, and the edit UI.

Changes:

  • Adds provider-level SSH port validation, normalization, persistence, and clone-time usage.
  • Introduces editable provider fields so the UI only renders whitelisted source-control settings.
  • Updates TypeScript/OpenAPI schemas and feature tests for SSH port behavior.

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Feature/SourceControlsTest.php Adds coverage for SSH port create/edit/default behavior and clone script rendering.
resources/views/ssh/git/clone.blade.php Adds SSH config and keyscan port handling.
resources/js/types/source-control.d.ts Adds optional ssh_port to source control type.
resources/js/types/index.d.ts Adds source-control provider editable_fields config typing.
resources/js/pages/source-controls/components/columns.tsx Renders editable provider fields dynamically in the edit dialog.
public/api-docs/openapi/schemas/SourceControl.yaml Documents ssh_port on source control responses.
app/SSH/OS/Git.php Passes provider SSH port into the clone script.
app/SourceControlProviders/SourceControlProvider.php Extends provider contract with SSH port/editability methods.
app/SourceControlProviders/Gitlab.php Adds GitLab SSH port data/rules/edit handling.
app/SourceControlProviders/Gitea.php Adds Gitea SSH port data/rules/edit handling.
app/SourceControlProviders/AbstractSourceControlProvider.php Provides defaults for SSH port and editability methods.
app/Providers/SourceControlServiceProvider.php Adds SSH port dynamic fields for GitLab and Gitea.
app/Plugins/RegisterSourceControl.php Exposes provider editable fields in source-control config.
app/Http/Resources/SourceControlResource.php Conditionally includes ssh_port in source control resources.
app/Actions/SourceControl/EditSourceControl.php Validates and saves provider-specific editable data during edits.

Comment thread public/api-docs/openapi/schemas/SourceControl.yaml
Comment thread resources/views/ssh/git/clone.blade.php
Comment thread app/SourceControlProviders/SourceControlProvider.php
Comment thread resources/js/pages/source-controls/components/columns.tsx Outdated
@RichardAnderson RichardAnderson force-pushed the feat/gitea-custom-port branch from ff90a26 to 60d6255 Compare May 19, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gitea Source Control Provider Does Not Accommodate Custom Ports

2 participants