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.
Failed to authenticate SSH session: Unable to open public key file
조회 수: 41 (최근 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!
댓글 수: 0
채택된 답변
Martin Kowalski
2022년 12월 27일
댓글 수: 3
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
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!!
참고 항목
카테고리
Help Center 및 File Exchange에서 Source Control Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!