SSH connection error only in Matlab 2021a

9 次查看(过去 30 天)
Dear Matlab-Community,
Whenever I try to connect to my GitLab instance using SSH with Matlab 2021a, I get an error git error (see below). Using SSH in the terminal works fine on all 4 PCs (Windows 10), however using SSH through Matlab doesn't work. This appears to be limited to MATLAB2021a, as one of the machines also runs MATLAB2019b, in which no issues occur and a ssh connection can be established and files can be uploaded and/or pulled.
Error-Message:
Git internal error (Code = -1, Class = 23): Failed to authenticate SSH session: Unable to open public key file
What has been done so far:
ssh-keygen -t rsa -b 4096 -m PEM
  • Tried various machines (4), which all lead to the same issue
  • Check "HOME" and "USERVARIABLE" systemvariables.
  • Installed MATLAB2019b to check for isssues with versions --> No issues using this version; ssh connection can be established
  • Checking ssh connection from terminal --> all workds nicely.
Thanks for our help!
  2 个评论
Olivier Megel
Olivier Megel 2021-11-11
Hi Alexander,
I am facing a similar issue although with Matlab 2021b. It works fine on 2019a. Did you manage to solve the issue in the end?
Best,
Olivier
Alex
Alex 2021-11-11
Hi Olivier,
So far I could't solve the problem. I updated my MATLAB R2021a - Update 5, but this didn't change anything.
Best,
Alexander

请先登录,再进行评论。

回答(1 个)

Chetan
Chetan 2024-5-8
Hi @Alex,
I understand that you're encountering an issue when trying to connect to your GitLab instance via SSH within MATLAB 2021a, with an error message indicating a failure to authenticate the SSH session due to the inability to open the public key file.
It appears MATLAB is not detecting the SSH keys. As a workaround, you can explicitly set the path of your PEM file and personal private key with the following commands:
git = settings().matlab.sourcecontrol.git;
git.PrivateKeyFile.PersonalValue = '/path/to/key';
git.PublicKeyFile.PersonalValue = '/path/to/key.pub';
Additionally, you can follow the steps outlined in the MathWorks Documentation linked below for further guidance:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by