files-community / files-community/Files
Feature: Implement SSH Authentication Support for Git Integration
- Dominant language
- C#
- Stars
- 45.4k
- Forks
- 2.9k
- Avg merge
- 19h 7m
- Merged PRs (30d)
- 62
Description
### 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!
Contributor guide
Research direction
Read GitHelpers.cs and its existing CredentialsProvider, then check LibGit2Sharp's SupportedCredentialTypes and SshUserKeyCredentials behavior. Trace how ContentDialog is used for an encrypted default SSH key. Done means SSH pull, push, and fetch operations authenticate with an optional passphrase while existing HTTPS/PAT behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100