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:
- I followed the instructions given here: https://www.mathworks.com/matlabcentral/answers/494543-why-do-i-receive-an-auth-fail-error-when-interacting-with-a-git-remote-over-ssh-in-matlab-or-why-d#answer_404449
- Re-generated the ssh-keys multiple times, always following the command mentioned above:
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
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
回答(1 个)
Chetan
2024-5-8
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!