Why is a password asked in Git Source Control when there is an SSH key?

11 ビュー (過去 30 日間)
I have a Git repository, and when I try to use Source Control integration in MATLAB, it always asks for a password. I have installed the ssh keys, and those work fine in Git for Windows terminal. The keys are placed in the correct location. I have the correct "HOME" environment variable. The output of command "git config --list":
diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true http.sslbackend=openssl http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt core.autocrlf=true core.fscache=true core.symlinks=false credential.helper=manager user.name=**************** user.email=****************core.symlinks=false core.repositoryformatversion=0 core.filemode=false core.logallrefupdates=trueremote.origin.url=http://****************.com/test/matlab.gitremote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master
How to get rid of the password prompt?

採用された回答

MathWorks Support Team
MathWorks Support Team 2025 年 1 月 24 日
編集済み: MathWorks Support Team 2025 年 1 月 31 日
As it can be seen in the 'remote.origin.url' above, the URL is on HTTP protocol and for SSH authentication, you need an SSH URL.
There are 5 kinds of git servers: [ Read more here: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols ]
  • Local
  • HTTP [You are currently using]
  • HTTPS
  • GIT
  • SSH [This is what you need to override password]
With that said, to overcome this issue, your URL should look like this:
ssh://[user@]server/project.git    OR   [user@]server:project.git
Additional troubleshooting steps:
  • If you follow these steps: Please run the following command in the command window of MATLAB R2020a to access the release-specific documentation:
    >> web(fullfile(docroot, 'matlab/matlab_prog/set-up-git-source-control.html'))
    , then you should have a HOME environment variable set that points to a folder containing a sub-folder .ssh, which in turn should contain your ssh keys. You can run the command "getenv('HOME')" to confirm that this environment variable is set up correctly.
  • Always run "ssh-keygen" in command prompt and not in git cmd.
  • Make sure you added/registered the keys with your git server.
  • Sometimes a proxy in your network can cause issues.
Please follow the below link to search for the required information regarding the current release:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSource Control についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by