zho*_*uji 88 git visual-studio-code
Visual Studio代码报告"看起来您的系统上没有安装git." 当我尝试切换到git视图.我知道我安装了git并被其他git客户端使用.我想如果我按照Visual Studio Code的说明重新安装git("用Chocolatey安装它或从git-scm.com下载它"),它可能可以解决问题,但我不想搞砸现有的git我系统上的客户.是否有可靠的方法来配置Visual Studio代码,以便它可以找到现有的git安装?
Nik*_*pić 110
现在,您可以配置Visual Studio代码(版本0.10.2,检查旧版本)以使用现有的git安装.
只需在Visual Studio代码设置(文件 - >首选项 - >设置)中添加git可执行文件的路径,如下所示:
{
// Is git enabled
"git.enabled": true,
// Path to the git executable
"git.path": "C:\\path\\to\\git.exe"
// other settings
}
Run Code Online (Sandbox Code Playgroud)
Edw*_*son 54
Visual Studio Code只是为您PATH寻找git.为简单起见,许多UI客户端都附带了"Portable Git",并且不添加git到路径中.
如果您将现有的git客户端添加到您的PATH(以便它可以找到git.exe),Visual Studio Code应该启用Git源代码管理.
EdS*_*dSF 23
老帖子,但只是点击这个MAC/OSX希望这有助于某人.
VS Code了一段时间,没有任何问题GitXCodeXCode,VS Code突然"找不到Git并要求您在设置中安装或设置路径"运行XCode(安装后第一次)并同意许可.而已.
我怎么偶然发现了这个"修复":
经过无数次的提示去有关检查后git,如which git和git --version,后者实际上提供的这种终端消息的线索:
同意Xcode/iOS许可证需要管理员权限,请运行"sudo xcodebuild -license"然后重试此命令.
至于为什么会把XCode它包起来git,WAT
节日快乐,快乐编码:)
小智 22
在Visual Studio代码中打开"用户设置":ctrl + p然后键入>settpressenter
这将打开左侧的默认设置和右侧的用户设置.
只需在用户设置中添加git.exe的路径即可
"git.path": "C:\\Users\\[WINDOWS_USER]\\AppData\\Local\\Programs\\Git\\bin\\git.exe"
Run Code Online (Sandbox Code Playgroud)
用您的用户名替换[WINDOWS_USER].
重新启动Visual Studio代码
Rak*_*Roy 12
首先检查您的系统中是否安装了 Git*
通过在 cmd /command prompt 中键入命令(在 Windows 中)
where git
Run Code Online (Sandbox Code Playgroud)
如果你得到这样的输出
? where git
C:\cmder\vendor\git-for-windows\cmd\git.exe
Run Code Online (Sandbox Code Playgroud)
然后去Settings > Preferences > Settings把下面的代码**放在右边。
{
// If git enabled ?
"git.enabled": true,
// Path to the git executable
"git.path": "C:\\cmder\\vendor\\git-for-windows\\cmd\\git.exe"
}
Run Code Online (Sandbox Code Playgroud)
** 就像\\上面的代码一样添加双斜线 ( ) 。
sta*_*ool 11
升级到 macOS Catalina 后我遇到了这个问题。
问题解决如下:
1. 从终端找到git位置:
which git
Run Code Online (Sandbox Code Playgroud)
2. 在设置文件中将 git 的位置添加到您的位置:
设置.json
"git.path": "/usr/local/bin/git",
Run Code Online (Sandbox Code Playgroud)
根据您的平台,用户设置文件 (settings.json) 位于此处:
视窗
%APPDATA%\Code\User\settings.json苹果系统
$HOME/Library/Application Support/Code/User/settings.jsonLinux
$HOME/.config/Code/User/settings.json
Jes*_*per 11
升级到macOS\xc2\xa0v13 (Ventura) < 13.0
\n截至 2022 年 11 月
\n升级到 macOS\xc2\xa0v13 (Ventura) 似乎不会对您的编码环境产生太大影响。
\n升级到 macOS\xc2\xa0v13 后,您的终端和 Visual Studio Code 将发出一些错误。例如:
\nIt looks like Git is not installed on your system ..\nRun Code Online (Sandbox Code Playgroud)\n或者
\ncan\'t find Git and asks you to either install or set the Path in settings\nRun Code Online (Sandbox Code Playgroud)\n某些错误取决于您的Z shell ( zsh) 设置或其他自定义设置。
这些常见问题只需重新安装Xcode命令行工具并更新Homebrew即可解决- 由于您的终端可能会受到影响,请从 Apple 的可执行文件https://developer.apple.com/download/all/重新安装\n开发者.苹果.com。您需要使用您的 Apple ID 登录。
\n安装后,更新 Homebrew:
\nbrew upgrade\nRun Code Online (Sandbox Code Playgroud)\nMac M1 - M2机器可能有一些本机和 ARM 应用程序,因此运行:
\narch -arm64 brew upgrade\nRun Code Online (Sandbox Code Playgroud)\n关闭所有终端和 Visual Studio Code 重新启动!
\n重新打开 Visual Studio Code,错误应该就会消失。
\n如果 Visual Studio Code 仍在寻找 Git 路径,则需要手动添加。
\n找到 Git 位置并从终端复制:
\nwhich git\nRun Code Online (Sandbox Code Playgroud)\n并在 Visual Studio Code JSON 设置文件中添加 Git 可执行文件的路径(菜单File \xe2\x86\x92 Preferences \xe2\x86\x92 Settings)查找并更新该行。它应该类似于:
\n"git.path": "/usr/local/bin/git",\nRun Code Online (Sandbox Code Playgroud)\n
跑步xcode-select --install。它会提示您安装命令行开发人员工具。安装工具并重新启动 Visual Studio Code。
您将看到 Git 在 Visual Studio Code 中再次运行。
小智 5
之后遇到同样的问题!
我怎么修的?
第 1 步:转到 vscode 中的设置。
第 2 步:打开 settings.json。
第 3 步:您需要在 settings.json 中找到类似“git.path”的内容
步骤4:只需添加系统中安装git的目录路径。
例如:“git.path”:“D:/Git/bin/git.exe”
第 5 步:重启你的 vscode。
希望这可以帮助。
我将 macOS 升级到macOS\xc2\xa0v12 (Monterey) 后遇到了这个问题。
\n事实证明,Xcode在我的 Mac 的新更新中已被删除。我刚刚尝试了以下建议的解决方案:
\nmacOS 更新后 Git 无法工作(“xcrun:错误:无效的活动开发人员路径 (/Library/Developer/CommandLineTools”)
\n| 归档时间: |
|
| 查看次数: |
120586 次 |
| 最近记录: |