필터 지우기
필터 지우기

Failed to authenticate SSH session: Unable to open public key file

조회 수: 54 (최근 30일)
After updating to MATLAB R2022b I cannot connect to the gitlab repo of my project anymore. When trying to push/pull or clicking on Source Control -> Remote -> Validate, I get always the message:
Unable to validate the specified path with the following git error: Unable to connect to the remote ssh://git@gitlab.tuwien.ac.at:822/...
Caused by: Failed to authenticate SSH session: Unable to open public key file
I followed all steps in the MATLAB-Help "Set Up Git Source Control". Tried to generate new keys, validated that they I can connect to my repo using these keys (outside matlab), validated the git.PrivateKeyFile.PersonalValue, git.PublicKeyFile.PersonalValue settings in MATLAB, validated filenames / paths / HOME-environment variable.
What else can I try? Thx for help!

채택된 답변

Martin Kowalski
Martin Kowalski 2022년 12월 27일
Problem solved, there is quite simply a typo in the MATLAB-Help "Set Up Git Source Control": the key-filenames "25519..." are mixed with "25119...". Although obvious, it was difficult for me to see.
  댓글 수: 3
Alec Bowman
Alec Bowman 2023년 1월 11일
I have been fighting this for literally months. Thank you!
Paul Bergman
Paul Bergman 2023년 3월 3일
Stared this for awhile...
git = settings().matlab.sourcecontrol.git;
git.PrivateKeyFile.PersonalValue = "C:\Users\username\.ssh\id_ed25119";
git.PublicKeyFile.PersonalValue = "C:\Users\username\.ssh\id_ed25119.pub";
Needs to be:
git = settings().matlab.sourcecontrol.git;
git.PrivateKeyFile.PersonalValue = "C:\Users\username\.ssh\id_ed25519";
git.PublicKeyFile.PersonalValue = "C:\Users\username\.ssh\id_ed25519.pub";
For those of us who scan things too quickly when reading. (... also you can copy and paste. )
:)
Thanks for the answer, it helped!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ritish Sehgal
Ritish Sehgal 2022년 12월 27일
I assume that you have already followed the documentation below:
But from the error message, it might be possible that the path was not set correctly. Ensure that the file for the private key and the public key point to a specific file and not just the directory.
You can verify this by running the below commands in your MATLAB command window:
>> git = settings().matlab.sourcecontrol.git;
% This should have the value '...\.ssh\<private_key_file>' and not '...\.ssh\'
>> git.PrivateKeyFile.PersonalValue
% This should have the value '...\.ssh\<public_key_file>.pub' and not '...\.ssh\'
>> git.PublicKeyFile.PersonalValue
If the above values are not set correctly, you can set them as follows:
>> git.PrivateKeyFile.PersonalValue = "C:\Users\<username>\.ssh\<private_key_file>";
>> git.PublicKeyFile.PersonalValue = "C:\Users\<username>\.ssh\<public_key_file>.pub";
Also, if your SSH key is passphrase protected but you do not specify this within MATLAB, then you will encounter an error. In this case, you must use the following command, so MATLAB knows the key pair is passphrase protected:
>> git = settings().matlab.sourcecontrol.git;
>> git.KeyHasPassphrase.PersonalValue = true;
If you think that your keys are passphrase protected but you do not know that passphrase, there is no way to reset the passphrase. Instead, you will have to generate a new SSH key pair.
It is also worth noting that, for the command line version of git, you can specify the paths to your SSH keys in a “.ssh/config” file, MATLAB does not read this file. You will still have to follow the steps in the above documentation to make your keys visible to MATLAB.
Hope it helps!!
  댓글 수: 1
Martin Kowalski
Martin Kowalski 2022년 12월 27일
Thank you for the answer, the filename for the ssh-keys was wrong because I copy and pasted it from the MATLAB help. Problem solved.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Source Control Integration에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by