GIT - Error using GIT in merging branches

3 views (last 30 days)
Xander Slot
Xander Slot on 17 Dec 2018
Edited: Divyam on 14 Oct 2024
Hi there, I would like to make use of GIT as a Source Control tool, via MATLAB integration, but I get an error when merging two branches. GIT, including GIT command line, is installed in C:\Program Files\GIT and I've filled in a valid (remote) repository and sandbox path using the Source Control manager. I am able to commit, push and fetch; but when I try to merge my current branch with a different branch, it gives an error stating:
"You need to install a command line GIT client before you can merge. See GIT installation instructions here."
Is it possible to enter the GIT installation path somewhere in Preferences/Options so that MATLAB knows where GIT command line is installed?
Thanks in advance for your help!
  1 Comment
Bogdan Bodnarescu
Bogdan Bodnarescu on 13 Jun 2022
Are you merging from Git Bash?
For me it works without any problems from the command line.

Sign in to comment.

Answers (1)

Divyam
Divyam on 14 Oct 2024
Edited: Divyam on 14 Oct 2024
In MATLAB, the source control integration is enabled by default and there are no settings to define the path for Git installation specifically.
Here, MATLAB is unable to find the Git command line to perform the merge. The root cause of this issue appears to be that the paths to your Git command line and "git.exe" executable are not added to your Environment variables. Adding these paths to your Enviroment variables will resolve the issue.
On my Windows computer, the "git.exe" executable and "cmd" folders are on the "C:\Program Files\Git\bin\git.exe" "C:\Program Files\Git\cmd" paths respectively.
To add these to the Windows Environment "Path" variable:
  • Search and open the Environment Variables in settings
  • Then, under System Variables, look for the "Path" variable and click edit
  • Add the paths to "git.exe" executable and "cmd" folder to the end of the list
You can then restart your machine and check the Git version using the follwing command that should return the version of Git installed on your machine.
git --version
If the issue persists, you can try to perform the merge using command line arguments or reinstall and reconfigure Git by following the instructions given here:

Categories

Find more on Source Control in Help Center and File Exchange

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!