Home >Development Tools >composer >Solve the problem that composer command cannot be used under git-bash

Solve the problem that composer command cannot be used under git-bash

藏色散人
藏色散人forward
2021-05-19 14:20:352395browse

下面由composer教程栏目给大家介绍解决git-bash下composer命令无法使用的问题,希望对需要的朋友有所帮助!

Solve the problem that composer command cannot be used under git-bash

git-bash下composer命令无法使用的问题

已经安装composer,写好composer.bat,并且设置好了path,在cmd下可以正常使用,但是在git-bash里面不行,其实真正的原因是,git-bash 不识别 composer.bat 文件,需要新建一个 composer 文件,输入如下内容:

#!/usr/bin/env sh
 
# php /path/to/composer.phar $*
php `dirname $0`/composer.phar $*

#!/usr/bin/env sh 有个这一行,git-bash 会自动识别为可执行文件,不需要也不能使用 chmod 命令修改权限。

The above is the detailed content of Solve the problem that composer command cannot be used under git-bash. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete