MATLAB Answers

Every time I push to the remote GitHub repository, I have to re-input my username and password. Is there some way to avoid this by having MATLAB store this information?

234 views (last 30 days)
It is convenient to have the Git support in MATLAB, but every time I push to the remote repository, I have to re-input my username and password. Is there some way to avoid this by having MATLAB store this information? When I use SourceTree to manage my Git repositories the account info is stored, but then SourceTree is not embedded in MATLAB. I would like to have the best of both.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 May 2020
Edited: MathWorks Support Team on 5 May 2020

  5 Comments

Show 2 older comments
Dmitry Boltyanskiy
Dmitry Boltyanskiy on 28 Sep 2019
I have the same problem. I can see: "Unable to pull in changes. git@github.com:MyUsername/MyProject.git: Auth fail". (I have checked, from command line all works without problem).

Sign in to comment.

More Answers (3)


Jonah Pearl
Jonah Pearl on 22 Jul 2020
I think the short answer here is, set up an SSH key instead of using the HTTPS method. NB, it is possible that you already have an SSH key and the SSH key requires using a passphrase, in which case the problem has just changed, not been solved. This second issue can also be solved, see How do I remove the passphrase for the SSH key without having to create a new key?.

  0 Comments

Sign in to comment.


埃博拉酱
埃博拉酱 on 29 Dec 2020 at 10:00
I tried all steps given by these two answers and the document on https://ww2.mathworks.cn/help/matlab/matlab_prog/set-up-git-source-control.html. Didn't work at all. MATLAB just always asked me for username and password and nothing like Auth fail had ever appeared.
Finally I had to contact the technical support. They saw my remote repository URL like https://github.com/Owner/Repository and told me to replace it with something like git@github.com:Owner/Repository.git! All cleared.
These documents and answers all assume that you are familiar with the SSH-Git workflow and nobody has ever mentioned about the URL difference between SSH and HTTPS. I always thought a HTTPS URL + a SSH key are all I need to access the remote repository without username and password. Nowhere in all these did I see any serious instruction that a special SSH URL is required.
I post my experience here, hoping someone like me will see this and quickly get his job done. However, I also strongly suggest the MATLAB official to update their document on this. If it's too wordy to talk about SSH-Git workflow in the MATLAB document, at least I want a hint or a reference so that followers won't make similar mistakes and waste so much time confusing.

Community Treasure Hunt

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

Start Hunting!