Now you can configure Visual Studio Code (version 0.10.2, check for older versions) to use an existing Git installation.
Just add the path to the Git executable in your Visual Studio Code settings (menu File → Preferences → Settings) like this:
{
// Is Git enabled
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\path\to\git.exe"
// Other settings
}
answered Nov 26, 2015 at 21:00
Nikola ProkopićNikola Prokopić
3,2163 gold badges17 silver badges20 bronze badges
11
Update 2020 (Mac)
I went through this $h!†
again after updating to macOS v10.15 (Catalina), which requires an Xcode update.
And to clarify, while this post is about Visual Studio Code, this issue, is system wide. Your Git install is affected/hosed. You can try to run git
in your terminal, Bash, Z shell (zsh
), or whatever. It is now and it just won’t.
It is the same fix. Just update Xcode. Start it up and agree to the license. That’s it.
I hit this on Mac/OS X.
Symptoms:
- You’ve been using Visual Studio Code for some time and have don’t have any issues with Git
- You install Xcode (for whatever reason — OS update, etc.)
- After installing Xcode, Visual Studio Code suddenly «can’t find Git and asks you to either install or set the Path in settings»
Quick fix:
Run Xcode (for the first time, after installing) and agree to license. That’s it.
How I stumbled upon this «fix»:
After going through numerous tips about checking git
, e.g., which git
and git --version
, the latter actually offered clues with this Terminal message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
As to why Xcode would even wrap it’s hands on git
, WAT.
answered Dec 22, 2017 at 18:41
EdSFEdSF
11.7k6 gold badges42 silver badges83 bronze badges
13
Visual Studio Code simply looks in your PATH
for git
. Many UI clients ship with a «Portable Git» for simplicity, and do not add git
to the path.
If you add your existing git client to your PATH
(so that it can find git.exe
), Visual Studio Code should enable Git source control management.
answered Apr 30, 2015 at 17:02
Edward ThomsonEdward Thomson
74k14 gold badges156 silver badges186 bronze badges
12
I had this problem after upgrading to macOS v10.15 (Catalina).
The issue is resolved as follows:
1.
Find the Git location from the terminal:
which git
2.
Add the location of Git in settings file with your location:
settings.json
"git.path": "/usr/local/bin/git",
Depending on your platform, the user settings file (settings.json) is located here:
Windows
%APPDATA%CodeUsersettings.json
macOS
$HOME/Library/Application Support/Code/User/settings.json
Linux
$HOME/.config/Code/User/settings.json
answered Mar 11, 2020 at 0:51
stayingcoolstayingcool
2,2141 gold badge20 silver badges24 bronze badges
3
This can happen after upgrading macOS. Try running Git from a terminal and see if the error message begins with:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) …
If so, the fix is to run:
xcode-select —install
from the terminal. See this answer for more details.
answered Feb 3, 2018 at 14:25
1
In Visual Studio Code, open ‘User Settings’: Ctrl + P and type >sett. Press Enter.
This will open the default settings on the left side and User Settings on the right side.
Just add the path to git.exe in user settings:
"git.path": "C:\Users\[WINDOWS_USER]\AppData\Local\Programs\Git\bin\git.exe"
Replace [WINDOWS_USER] with your user name.
Restart Visual Studio Code.
answered Jan 5, 2016 at 9:41
BartoshBartosh
4114 silver badges3 bronze badges
3
First check if Git* is installed or not in your system by typing the command in cmd /command prompt (in Windows):
where git
If you get an output like this,
λ where git
C:cmdervendorgit-for-windowscmdgit.exe
Then Go to Settings → Preferences → Settings and put the bellow code** right part.
{
// If git enabled?
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\cmder\vendor\git-for-windows\cmd\git.exe"
}
- If you don’t have Git installed, install Git from https://git-scm.com/
** Just add a double slash (\
), just like the above code.
answered Apr 28, 2018 at 14:14
Rakesh RoyRakesh Roy
9301 gold badge12 silver badges22 bronze badges
1
Upgrade to macOS v13 (Ventura) < 13.0
As of November 2022
Upgrading to macOS v13 (Ventura) does not seem to affect your coding environments too much.
After upgrading to macOS v13, your Terminal and Visual Studio Code will give off a few errors. Such as:
It looks like Git is not installed on your system ..
or
can't find Git and asks you to either install or set the Path in settings
Some errors depend on your Z shell (zsh
) setup or other customizations.
These common problems can be resolved by simply by reinstalling the Xcode command-line tools and updating Homebrew — since your terminal might be affected, reinstall from Apple’s executable https://developer.apple.com/download/all/
developer.apple.com. You will need to log in with your Apple ID.
Once installed, update Homebrew:
brew upgrade
Mac M1 — M2 machines likely have some native and ARM applications, so run:
arch -arm64 brew upgrade
Close all terminals and Visual Studio Code to restart!
Reopen Visual Studio Code, and the errors should be gone.
If Visual Studio Code is still looking for the Git path, you will need to add it manually.
Find the Git location and copy from the terminal:
which git
And add the path to the Git executable in your Visual Studio Code JSON settings file (menu File → Preferences → Settings) find and update the line. It should look similar to:
"git.path": "/usr/local/bin/git",
answered Nov 7, 2022 at 21:12
JesperJesper
1111 silver badge5 bronze badges
1
After an OS X update, I had to run xcode-select --install
for GitLens to work.
answered Nov 22, 2018 at 11:29
Induja VJInduja VJ
811 silver badge2 bronze badges
1
I ran into the same problem after!
How did I fix it?
Step 1: Go to the Settings in Visual Studio Code.
Step 2: Open settings.json.
Step 3: You need to find something like «git.path» in settings.json
Step 4: just add the directory path where Git is installed in your system.
Example: «git.path»: «D:/Git/bin/git.exe»
Step 5: Restart your Visual Studio Code.
answered Mar 7, 2021 at 4:11
confused_confused_
9638 silver badges10 bronze badges
1
Run xcode-select --install
. It’ll prompt you to install command line developer tools. Install the tools and restart your Visual Studio Code.
You’ll see Git working once again in Visual Studio Code.
answered Nov 5, 2021 at 6:00
kannappankannappan
2574 silver badges13 bronze badges
0
Visual Studio Code 1.50 (Sept 2020) adds an interesting alternative with issue 85734:
Support multiple values for the
git.path
settingI use VSCode in three different places; my home computer, my work computer, and as a portable version I carry on a drive when I need to use a machine that doesn’t have it.
I use an extension to keep my settings synced up between editors, and the only issue I’ve encountered so far is that the git path doesn’t match between any of them.
- On my home machine I have it installed to
C
of course,- work likes to be funny and install it on
A
,- and for the one on my drive I have a relative path set so that no matter what letter my drive gets, that VSCode can always find
git
.I already attempted to use an array myself just to see if it’d work:
"git.path": ["C:\Program Files\Git\bin\git.exe", "A:\Git\bin\git.exe", "..\..\Git\bin\git.exe"],
But VSCode reads it as one entire value.
What I’d like is for it to recognize it as an array and then try each path in order until it finds Git or runs out of paths.
This is addressed with PR 85954 and commit c334da1.
With Visual Studio Code 1.60+
"git.enabled": true
git.path
answered Sep 19, 2020 at 6:47
VonCVonC
1.2m519 gold badges4346 silver badges5166 bronze badges
I faced this problem on macOS v10.13.5 (High Sierra) after upgrading Xcode.
When I run the git
command, I received the below message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
After running the sudo xcodebuild -license
command, the below message appears:
You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
Hit the Enter key to view the license agreements at ‘/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf’
Typing the Enter key to open the license agreements and typing the space key to review details of it, until the below message appears:
By typing ‘agree’ you are agreeing to the terms of the software license agreements. Type ‘print’ to print them or anything else to cancel, [agree, print, cancel]
The final step is simply typing agree
to sign with the license agreement.
After typing the git
command, we can check that Visual Studio Code detected Git again.
answered Jun 20, 2018 at 1:42
PengyyPengyy
37.2k15 gold badges83 silver badges73 bronze badges
I have recently started with Visual Studio Code. I have this issue and just writing the exact path of the Git executable solves
the issue. Here is the code:
«git.path»: «C:Program FilesGitbingit.exe»,
answered May 3, 2018 at 6:02
Ajmal AamirAjmal Aamir
1,0558 silver badges8 bronze badges
1
If you have multiple environments. You could include Git Path in the Visual Studio Code Workspace Setting. For Windows, depending on your setting, you could hit Ctrl + P, search for «settings». Open settings.json (or menu File → Preferences → Settings). Navigate to Workspace Settings. Find «Path» and add paths to Git bin and cmd folders.
Environments can have their own paths. I discovered this when I echoed my PC %PATH% on cmd. Git bin and cmd path where available, but when I was working on my project, echoed %PATH% did not have git and cmd folder. Adding them, as shown above, solved the issue.
Extra Notes:
On cmd, you can echo «%PATH%» and see if git bin and cmd folders are included. If not, you could concatenate using SETX
PATH on, for example,
SETX PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;"
This will make git available on local, root but not in some environments which comes with their own paths (SETX /M PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;"
would have though).
In case you have a long Path that is chopped off due to Path length (getting «Error: Truncated at X characters.» message), you can increase the path length in RegEdit.
- In «Search Windows», search for «regedit». Right-click to open as Administrator.
- Go to ComputerHKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlFileSystem
- Right-click and modify. Change value data from 0 to 1
This will increase your path length. If it is already one, then I am not sure how to proceed from there :).
[9
answered Dec 16, 2017 at 5:58
macOS — Visual Studio Code.
Step 1: Go to Visual Studio Code, menu File → Preferences → Settings (or Ctrl + ,).
Step 2: Type ‘Path’ in the search bar. You will get a result list that contains Git.
Step 3: Click on Git. After that, click on Edit in settings JSON file.
Step 4: In your Mac Terminal, type which git. You will get the Git path
Step 5: Just copy that path and add again the path key in the JSON file.
answered Mar 27 at 12:20
utkal patelutkal patel
1,3011 gold badge15 silver badges24 bronze badges
1
Three years later, I ran into the same issue. Setting the path in user settings & PATH environment variable didn’t help. I updated Visual Studio Code and that solved it.
answered Apr 8, 2018 at 9:12
hgolovhgolov
6501 gold badge11 silver badges28 bronze badges
First install Git onto your desktop, and then add the encircled extension in Visual Studio Code, as seen in the picture.
That helped me fix the same issue you have.
answered Jan 22, 2019 at 10:03
Open
C:UsersnassimAppDataRoamingCodeUsersettings.json
Comment any Git line there:
// ...
// "git-graph.integratedTerminalShell": "E:\Apps\Git\bin\bash.exe",
// "git.path": ""
//...
And add git.exe to the OS path.
Note for me: Fixing this Git error also fixed the npm error too. Since they are both defined in the path, if one fail, the remaining will fail as well.
answered May 6, 2020 at 14:49
NassimNassim
2,8512 gold badges37 silver badges38 bronze badges
In my case, Git was installed on my Windows 10 OS and there was an entry in PATH variable. But Visual Studio Code 1.52.1 still is unable to detect it from a terminal window, but it was available in a CMD console.
The problem was solved by switching the terminal from PowerShell to CMD or shell, and a Visual Studio Code restart.
answered Jan 17, 2021 at 11:40
aleha_84aleha_84
8,2592 gold badges38 silver badges46 bronze badges
- Make sure Git is enabled (menu File → Preferences → Git Enabled) as other have mentioned.
- Make sure Git is installed and in the PATH (with the correct location, by default: C:Program FilesGitcmd) — PATH in System Variables, BTW
- Change the default terminal. PowerShell can be a bit funny, and I recommend Git Bash, but cmd is fine. This can be done by selecting the terminal dropdown and selecting ‘set default shell’ and then creating a new terminal with the + button.
- Restart Visual Studio Code, and sometimes reboot if that fails.
answered Nov 24, 2020 at 22:33
TheoTheo
458 bronze badges
1
I solved the same problem on macOS with an M1 Pro processor by installing the GitLens Visual Code extension. The changed files were displayed after enabling the extension. Then I turned to reloading Visual Studio Code and there were no changes, but once I ran
git status
in the terminal, it showed all the files, and all changes were tracked.
answered Dec 9, 2021 at 13:26
emiremir
1,3161 gold badge14 silver badges31 bronze badges
The only way I could get to work in my Windows 8.1 is the following:
Add to system environment variables (not user variables):
C:UsersUSERNAMEAppDataLocalGitHubPortableGit_YOURVERSIONbin;C:UsersUSERNAMEAppDataLocalGitHubPortableGit_YOURVERSIONlibexecgit-core;C:UsersUSERNAMEAppDataLocalGitHubPortableGit_YOURVERSIONcmd
This fixed the «it looks like Git is not installed on your system» error on my Visual Studio Code.
answered May 22, 2015 at 18:39
I faced this issue after updating macOS!
I installed Git again using Homebrew, and it worked!
brew install git
answered Sep 15, 2022 at 10:46
cmcodescmcodes
1,49917 silver badges24 bronze badges
I edited Path into System Environment and add «C:Program FilesGitbin» then restart Vscode. It’s worked for me. I don’t understand why I am using it normally then I have this problem. Maybe during the installation of something it causes that problem.
answered Mar 14, 2022 at 8:54
Nam LeeNam Lee
8411 gold badge9 silver badges19 bronze badges
I found that I had git: false in settings.json and changed it to true. It works now.
answered Jun 22, 2019 at 6:10
kaidojkaidoj
3531 gold badge4 silver badges5 bronze badges
Here’s what worked for me. Instead of using the Visual Studio Code terminal to run your Git commands, run the Git commands from a cmd terminal at the path of your application.
answered Jan 10, 2020 at 6:03
dizad87dizad87
4484 silver badges15 bronze badges
For a Linux-based OS: I had such an issue due to a corrupted path, but I was able to temporarily fix the issue and my Git installation was immediately restored.
In case you’re facing such path issue type the command below
export PATH="/usr/bin:/bin:$PATH"
answered Jun 29, 2020 at 17:14
stanley mbotestanley mbote
8901 gold badge7 silver badges17 bronze badges
Сам гит интсталлировал. Bower установил и глобально и локально.
Нашёл инструкцию тут как менять пути какие-то (https://stackoverflow.com/questions/20666989/bower… ), но что-то не уверен стоит ли там что-то менять.
-
Вопрос заданболее трёх лет назад
-
5806 просмотров
Там галочка по умолчанию стоит, как я понял, но немного по-другому называется.
Просто я не через git заходил, а через обычную командную строку.
Пригласить эксперта
Если у вас нет git и git bash, то скачайте его с официального сайта git-scm.com
Если вы пользователь windows, не забудьте во время установки перевести radio button в положение «Run Git from the Windows Command Prompt». Таким образом, git автоматически будет добавлен в ваш PATH, что в будущем сэкономит вам силы и сбережет ваши нервы.
Добавить нужную папку в PATH вручную.
В Windows 8.1 это через «Панель управления» (или ПКМ на кнопке «Пуск») — «Система» — «Дополнительные параметры системы» — вкладка «Дополнительно» (активна по умолчанию) — «Переменные среды…» (кнопка внизу) в список Path добавляем
;%PROGRAMFILES(x86)%Gitbin;%PROGRAMFILES(x86)%Gitcmd
и перезагрузить компьютер.
Так что правильную вы инструкцию нашли)
set PATH=%PATH%;C:Program FilesGitbin;
-
Показать ещё
Загружается…
09 июн. 2023, в 23:05
80000 руб./за проект
09 июн. 2023, в 22:45
1000 руб./за проект
09 июн. 2023, в 22:39
1000 руб./в час
Минуточку внимания
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
- Pick a username
- Email Address
- Password
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Добрый день всем, кто оказался на данном сайте. По умолчанию терминал в Linux не может похвастаться каким то особенным оформлением. Это и понятно, по большому счету это и не к чему. Но все же иногда хочется что бы терминал выглядел не так скучно как он выглядит по умолчанию. Да, можно изменить цвет и так далее. Но есть и более интересное средство, это “ZSH”. Он не просто привнесет некое разнообразие в цветовой схеме терминала, но и расширит его возможности. О том что такое ZSH и для чего он был создан, можете ознакомится на вики. А сейчас давайте перейдем к установке.
Сначала нам нужно установить ZSH в нашу систему, в подавляющем большинстве он есть в репозиториях. Все действия я буду выполнять в Linux Mint, но все то же самое подойдет и для других deb ориентированных систем.
sudo apt install zsh
Теперь давайте установим дополнения, сами разработчики с сайта предлагают скачать его при помощи “wget” или “curl”. В зависимости что у вас стоит в системе. Разницы между этими инструментами особой нет. И так, скачиваем:
Для wget:
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Для curl:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
При установке у вас спросят, установить ли zsh терминалом (Shell) по умолчанию? отвечаем утвердительно, то есть ставим “y” и нажимаем “Enter”. После чего вводим пароль:
Ошибка git is not installed
При возникновении ошибки типа “Error: git is not installed”, вам нужно установить “git”
Для установки “git” достаточно ввести команду все в том же терминале:
sudo apt install git
Устанавливаем темы zsh
Теперь давайте собственно и изменим тему оформления. Для этого нужно отредактировать файл zshrc. Он находится в домашней директории пользователя и скрыт. Для его редактирования можно воспользоваться либо текстовым редактором либо терминальным nano. Я покажу пример с nano:
sudo nano ~/.zshrc
Далее ищем строчку начинающуюся с ZSH_THEME. Эта опция как раз и отвечает за оформления, то есть, за тему. Тут нам нужно привести ее примерно к следующему виду:
ZSH_THEME="agnoster"
То есть, просто вписать название новой темы в эту строчку, сами темы вы можете найти на github.
Теперь давайте установим шрифты. Для этого возвращаемся в терминал и вводим команды:
sudo apt install fonts-powerline
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
Ну и останется нам только перезапустить терминал. После того как вы запустите его снова, то увидите примерно следующее:
Цвета вы так же спокойно можете менять в настройках самого терминала. Для этого достаточно просто отредактировать профиль:
А на этом сегодня все. Надеюсь данная статья будет вам полезна.
С уважением Cyber-X
IDEA uses git error git is not installed
tags: IDEA intellij idea
Intelligent Recommendation
Solve the git error in IDEA
Problem Description: Solve Failed to Connect to 127.0.0.1 Port 1080: Connection Refused error Solve: Ok, I have seen a lot of people’s answer, they all copy each other, it seems to be said, but it is …
Git uses error reporting
1. When committing (git add .) newline characters have conversion problems on different operating systems: Solution: Check out this article specifically 2, whe…
Error occurs when IDEA uses the git command commit
When the local code is modified in the idea, I want to push it to the remote warehouse, and it keeps appearing during commit The problem as shown in the picture above occurred. It was a long time sinc…
More Recommendation
Git installed on Alibaba Cloud and error
1. Download git Git platform installation package download address is:http://git-scm.com/downloads 2. Install the dependencies of the specified system: 3. Unzip the downloaded source package: 4. If th…
Idea+git uses git push rejected to resolve
Use git to submit a local file to the remote branch, prompting git push rejected The reason is that the branch code version of the local repository is inconsistent with the version of the remote branc…
Idea uses Git to submit code
Step 1: Right click on the project and select Git. Step 2: Commit, select the code you need to submit The third step: pull, (merge may appear after the pull, if you are prompted to have file conflicts…