MATLAB and Git source control

조회 수: 34 (최근 30일)
CoolNickname
CoolNickname 2019년 6월 27일
댓글: Bengisu Ozbay 2023년 12월 18일
Hi,
I'm struggling to set up Git Source Control in MATLAB and couldn't find a solution elswhere.
The option called "Use Git from the Windows Command Prompt" meanwhile changed in name though. For all other options not listed in the tutorial I chose the default one.
Now, I open MATLAB, right click in the "Current Folder" browser > Source Control > Manage Files.
I choose "Git" as source control integration, fill in the https path to my Git repository and select the path to an empty folder as my Sandbox. I klick retrieve and the files in GitHub will be downloaded to that specific folder. So far so good. But there is no .git folder created as I saw in other tutorials. If I want to add a new file to this folder, I right click on the file > Source Control > Add to Git. Now the circle is replaced by a black cross or plus. According to some articles and the official MATLAB video, I should right click on the file again > Source Control > Commit to Git Repository. And that's kind of the point where things get stuck. First, there isn't this option. I can only choose "View and Commit Changes" and the standard Git options. Well, I tried "View and Commit Changes", but npthing happens except MATLAB opening an invisible window in which I may be supposed to view and commit changes. But I can't see this window, I just see MATLAB flashing orange in the task bar. So that doesn't work. Then I tried the option "Push". Unfortunately that leads to an error "The target reference is already up to date no action required. refs/heads/master->refs/remotes/origin/master".
That's my problem and I'm hoping for your help.
What also bothers me is that MATLAB requires the entry of my Git username and password every time I want to conduct an action. Isn't it possible to avoid this?
Many thanks in advance for your help and best regards.
  댓글 수: 3
CoolNickname
CoolNickname 2020년 2월 26일
Hi Aditya,
sorry for my late reply. Unfortunately not. I used manual backups instead. Not as elegant, but since I was the only one to work with the code, it did the trick for me.
Best regards.
Bengisu Ozbay
Bengisu Ozbay 2023년 12월 18일
Hello,
I was just having some similar having an invisible "View and Commit window" issue recently while trying to use MATLAB with git. When I close and restart my MATLAB I was able to see the "View and Commit window" where I can write commit messages and pick which one of the changed files to commit.
Regarding requiring the password since commiting changes does not require and password I just stick with that for the minor changes and push my commits daily or whenever I have a major edit.
I hope it will help anybody who may have the same problems in the future.

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

답변 (1개)

atervn2
atervn2 2020년 2월 26일
편집: atervn2 2020년 2월 26일
Hello,
I had the same problem and I was able to get it somewhat working. When the invisible View and Commit Changes window "appeared", I right-clicked it in the taskbar and selected Maximize. This made the window appear and it mainly seems to work normally during the same Matlab session, but sometimes I have to do it again. Also, after starting Matlab again it I have to always maximize the window again when committing for the first time.
Hopefully this helps other people having the same problem! I have Win 10 and Matlab R2019a.
  댓글 수: 2
CoolNickname
CoolNickname 2020년 2월 28일
Hi, many thanks for your feedback. Sounds very reasonable. Will try it out next time.
atervn2
atervn2 2020년 2월 29일
No problem! Also, noticed yesterday that when you use projects, there is a "Source Control" section in the project ribbon menu. The "Commit" button there does not have the invisible window problem at all.

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by