Skip to content

Feature: Implement SSH Authentication Support for Git Integration #17692

@NyanHeart

Description

@NyanHeart

What feature or improvement do you think would benefit Files?

Currently, the Git integration in Files only supports authentication over the HTTPS protocol, primarily using GitHub Personal Access Tokens (PATs) obtained via an OAuth login flow.

This means that any repository that has been cloned using an SSH URL (e.g., git@github.com:user/repo.git) cannot perform authenticated network operations like pull, push, or fetch. These operations fail because the application is unable to provide the SSH key credentials required by the Git remote.

This is a significant limitation for developers who prefer using SSH for its security and convenience, effectively preventing them from using the integrated Git features for their existing projects.

Requirements

I propose to implement full authentication support for the SSH protocol. This would involve the following key changes, primarily within the GitHelpers.cs file:

  1. Enhance the CredentialsProvider: The existing CredentialsProvider callback will be updated to intelligently handle different credential requests from LibGit2Sharp.
  2. Detect SSH Requests: The handler will now check if the required credential type is SupportedCredentialTypes.SshKey.
  3. Provide SSH Key Credentials: When an SSH key is requested, the handler will locate the user's default SSH private key (e.g., ~/.ssh/id_rsa).
  4. Support for Passphrases: If the private key is encrypted with a passphrase, a ContentDialog will be displayed, securely prompting the user to enter it.
  5. Complete Authentication: The key path and the (optional) passphrase will be used to create and return an SshUserKeyCredentials object, allowing the SSH authentication to succeed.

This solution would seamlessly enable SSH support while retaining the existing functionality for HTTPS authentication.

Files Version

4.0.11.0

Windows Version

10.0.26100.6584

Comments

Adding SSH support would significantly enhance the Git functionality in Files.

I have already spent time investigating the codebase and have a clear implementation plan. I am willing to contribute the code for this feature and submit a Pull Request.

Before I begin development, I wanted to open this issue to discuss the plan with the project maintainers. I would greatly appreciate any feedback or guidance on this approach.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area - gitFeatures or bug reports relating to git

    Projects

    Status

    📋 Planning stage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions