Matlab to GitLab connection with SSH returns git error: resolve: The specified class was not found

17 views (last 30 days)
Hello,
we've been attempting to establish the source control feature in Matlab R2022b with our Gitlab Server via SSH (Https not possible due to authentification) and we keep getting the same error message, when validating or connecting with the server:
"Unable to validate the specified path with the following git error:
resolve: the specified class was not found"
The SSH connection works flawlessly with Tortoise Git in the Windows Explorer.
The following steps have been taken
  1. Key Generation from Windows Command window
  2. Private Key is an OPENSSH type (apperently supported for R2022b and for all Releases after R2021a)
-----BEGIN OPENSSH PRIVATE KEY-----
*key*
-----END OPENSSH PRIVATE KEY-----
3. Environment variable 'Home' is set to the user directory: C:/Users/user/
4. Matlab Git settings
git = settings().matlab.sourcecontrol.git;
git.PrivateKeyFile.PersonalValue = "C:\Users\user\.ssh\ssh_key_20231113";
git.PublicKeyFile.PersonalValue = "C:\Users\user\.ssh\ssh_key_20231113.pub";
git.KeyHasPassphrase.PersonalValue = true;
5. Public Key is stored in GitLab
We also tried to find config files for the git SSH connection within the MATLAB directory on the hard drive, but all files are encrypted, so there is no chance to manually adjust a config.
We're having this issue with the SSH connection over Matlab Source control with all git-servers we've been using until now, only HTTPS worked has so far, but is currently no option for the GitLab server.
I'd hope for reasonable solutions from MathWorks or anyone with a similar problem. Moving to a newer release is possible, but I'd expect that the Source Control feature should work with a reasonably new version as R2022b.

Accepted Answer

MaVo
MaVo on 21 Nov 2023
Together with the MathWorks support we're able to solve this problem. In our case, there was no standard port assigned for the SSH connection by the IT department. Matlab looks first in standards defined by the operating system in the folder "C:\Windows\System32\drivers\etc\services". There should be an entry for the port 22, which in our case wasn't there.
ssh 22/tcp #SSH Remote Login Protocol
Next issue was the adress format of GitLab for the SSH-path, which is in the "scp" format, when using the adress directly from GitLab, which does not allow to select the port manually. In order to do this, one has to use the standard SSH syntax (See version control - Git on custom SSH port - Stack Overflow)
  • standard syntax ssh://[user@]host.xz[:port]/path/to/repo.git/ (Variant to manually choose the port)
  • scp like syntax [user@]host.xz:path/to/repo.git/ (GitLab standard)
Changing the repository adress to the standard syntax with a defined port, resulted in getting the SSH-connection to work properly.
For an existing project, changing the adress from "https" to "ssh" did not work. The workaround here was to import the project directly via Home--> Import from Git to a new sandbox folder.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!