Configure Matlab for GIT on Windows

42 ビュー (過去 30 日間)
Rocco Di Taranto
Rocco Di Taranto 2022 年 5 月 5 日
回答済み: Rocco Di Taranto 2022 年 5 月 6 日
I want to install Git on R2021b version, i am following the step which was given here git
To configure MATLAB® to use Git™ Hooks on Windows®, install Cygwin and add it to the MATLAB library path. Git Hooks are custom scripts that can be triggered by operations such as committing, merging, and receiving pushed commits.
  1. Download the installer from https://www.cygwin.com/. Run the installer.
  2. Open librarypath.txt. In the MATLAB Command Window, enter:edit(fullfile(matlabroot,"toolbox","local","librarypath.txt"))Add the Cygwin bin folder location to the end of librarypath.txt, for example, C:\cygwin64\bin.If you do not have permission to edit the librarypath.txt file, see Locate Native Method Libraries.
I do not have permission to edit the file, I am trying to follow instructions here Locate Native Method Libraries. But I am not able to solve the issue. Can anybody help me with this?
Thank you

採用された回答

Andreas Apostolatos
Andreas Apostolatos 2022 年 5 月 5 日
Hi Rocco,
The step of installing Cygwin and adding it to the MATLAB library path is just an optional step in case you want to use Git hooks with MATLAB. If you just want to use basic Git functionality with MATLAB, then installing Git and having it added to the Path environment variable is enough.
After installing Git, locate in your computer the git.exe executable. In my case this is installed in the following directory:
C:\Users\<myusername>\AppData\Local\Programs\Git\cmd
This directory then needs to be placed in the Path environment variable, see for instance the following screenshot,
To verify that this has taken effect, just open a Windows CMD Terminal and type the following command,
$ git --version
If you get the git version as output, then Git has been appropriately added to your Path environment variable. Just restart MATLAB and you should be able to use Git with MATLAB.
You may want to consider adding the following commands into a MATLAB startup.m file,
!git config --global core.longpaths true
git = settings().matlab.sourcecontrol.git;
git.KeyHasPassphrase.PersonalValue = true;
The first command allows files stored in long paths to be added to be Git-versioned while the other two let you to enter your passphrase only once per MATLAB session.
I hope this information helps.
Kind regards,
Andreas

その他の回答 (1 件)

Rocco Di Taranto
Rocco Di Taranto 2022 年 5 月 6 日
Thank you Andreas! This helped!
Rocco

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by