作曲家说找不到 Git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17792588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Composer says Git not found
提问by my2c
When installing dependencies via "composer install"
, I'm getting error:
通过 安装依赖项时"composer install"
,出现错误:
Installing doctrine/lexer (dev-master bc0e1f0) Cloning bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94 [RuntimeException] Failed to clonehttp://github.com/doctrine/lexer.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as an internal or external command, operable program or batch file.
安装学说/词法分析器(DEV-主bc0e1f0)克隆bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94 [RuntimeException的] 无法克隆http://github.com/doctrine/lexer.git,没有被发现的git,检查它安装在你的PATH环境。'git' 不是内部或外部命令,也不是可运行的程序或批处理文件。
I'm not sure what to do... I don't need git. Thanks!
我不知道该怎么办……我不需要 git。谢谢!
回答by my2c
Using --prefer-dist
worked:
使用--prefer-dist
工作:
composer install --prefer-dist
to force dist
part, which @ivoba mentioned; it seems default switch which uses git
is --prefer-source
.
强制dist
部分,@ivoba 提到的;似乎使用的默认开关git
是--prefer-source
.
回答by user2718285
You should install git first
你应该先安装git
apt-get install git
回答by abdiel
I had the same problem in windows and already installed git, so I fixed it just adding
我在 Windows 中遇到了同样的问题并且已经安装了 git,所以我修复了它只是添加
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Git\bin
to my path enviroment var.
到我的路径环境变量。
回答by Janaka Pushpakumara
I had the same issue. So I first used
我遇到过同样的问题。所以我第一次使用
composer install --prefer-dist
But it didn't work for me.
但它对我不起作用。
Then I used these commands and I solved my issue.
然后我使用了这些命令并解决了我的问题。
apt-get install zip
composer install --prefer-dist
This works for me. I think this will help someone.
这对我有用。我认为这会帮助某人。
回答by Kjell
On El Capitan on a fresh installation you first may also run into this problem although GIT is installed. After typing sudo git --help
in the terminal you get a request to agree to the XCode licence terms. Walk through this procedure and then you are good to go. Weird stuff!
在全新安装的 El Capitan 上,尽管安装了 GIT,但您首先也可能会遇到此问题。在sudo git --help
终端中输入后,您会收到同意 XCode 许可条款的请求。完成此过程,然后您就可以开始了。奇怪的东西!
回答by ivoba
You will need git, almost always with composer.
您将需要 git,几乎总是与作曲家一起使用。
from the requirements;
从要求;
To install packages from sources instead of simple zip archives, you will need git, svn or hg depending on how the package is version-controlled.
要从源安装包而不是简单的 zip 存档,您将需要 git、svn 或 hg,具体取决于包的版本控制方式。
best you get git :)
最好你得到 git :)
update:
you could also try to override the package definition, so that they will try to get zip instead:
As fake example:
更新:
您也可以尝试覆盖包定义,以便他们尝试获取 zip:
作为假示例:
{
"type": "package",
"package": {
"name": "doctrine/lexer",
"version": "3.1.7",
"dist": {
"url": "http://www.doctrine.net/files/doctrine.zip",
"type": "zip"
}
}
https://github.com/composer/composer/blob/master/doc/04-schema.md#repositories-root-only
https://github.com/composer/composer/blob/master/doc/04-schema.md#repositories-root-only
I did not test this, and i predict you end up in hell ;) when you will try to rewrite the f.e. doctrine composer.json.
我没有测试这个,我预测你最终会陷入地狱;) 当你尝试重写 fe 学说 composer.json 时。