Push code error in git :Unable to locate the Git executable
21 次查看(过去 30 天)
显示 更早的评论
When I try to use git to push code to the github repository in matlab, a window pops up asking me to enter my account and password. After I input, this figure appears.
However, I configured the ssh key. At the same time,when installing git, I installed the Git Credential Manager Core. I don't know how to solve this problem. Can someone help me?
回答(1 个)
Divyam
2024-10-14
It seems that the issue stems from the Windows Environment not being able to locate the Git executable. To check whether "git" is recognized in your Windows environment, open the command prompt and type "git".
If "git" is not recognized as a command, then recheck the installation of Git on your machine. If Git is installed on your system, adding the path to "git.exe" executable and Git "cmd" folder to your Windows "Path" Environment variable will resolve this issue.
On my 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
As an additional step, if you wish to enter your passphrase only once per MATLAB session, you can add the following commands in your MATLAB "startup.m" file
git = settings().matlab.sourcecontrol.git;
git.KeyHasPassphrase.PersonalValue = true;
For more information regarding the "startup" files, refer to this documentation: https://www.mathworks.com/help/matlab/ref/startup.html
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Source Control 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!