使用 composer 安装YII2时, 如题所示提示, 原因是由于yii安装中, 需要有一些相关的认证[或许说是composer的认证], 如有如下提示
Could not fetch https://api.github.com/authorizations, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /home/debm/.composer/auth.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username:
那么可以输入github的帐号与密码进行下一步的安装, 如果输入了帐号, 密码, 还继续让输入的话, 是因为 红字标出的文件不可写, 可以到
composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
这一步执行之后, 所生成的文件夹里, 把 .composer 文件夹, 修改权限为 777 权限. 然后, 再重新执行
composer create-project yiisoft/yii2-app-basic basic 2.0.1
此命令. 如果仍然继续提示输入帐号, 密码的话, 大可 ctrl-d 退出, 然后重新执行 composer create-project yiisoft/yii2-app-basic basic 2.0.1 这一命令.
可能是由于缓存或是其他原因导致, 最后就可以看到执行成功的界面了
[email protected]:/var/www/local.yii2.eg$ sudo composer create-project yiisoft/yii2-app-basic basic 2.0.1 Installing yiisoft/yii2-app-basic (2.0.1) - Installing yiisoft/yii2-app-basic (2.0.1) Loading from cache Created project in basic Loading composer repositories with package information Installing dependencies (including require-dev) - Installing yiisoft/yii2-composer (2.0.1) Downloading: 100% - Installing ezyang/htmlpurifier (v4.6.0) Downloading: 100% - Installing swiftmailer/swiftmailer (v5.3.1) Downloading: 100% - Installing bower-asset/jquery (2.1.3) Downloading: 100% - Installing bower-asset/yii2-pjax (v2.0.2) Downloading: 100% - Installing bower-asset/punycode (v1.3.2) Downloading: 100% - Installing bower-asset/jquery.inputmask (3.1.49) Downloading: 100% - Installing cebe/markdown (1.0.1) Downloading: 100% - Installing yiisoft/yii2 (2.0.1) Downloading: 100% - Installing yiisoft/yii2-swiftmailer (2.0.1) Downloading: 100% - Installing yiisoft/yii2-codeception (2.0.1) Downloading: 100% - Installing bower-asset/bootstrap (v3.3.1) Downloading: 100% - Installing yiisoft/yii2-bootstrap (2.0.1) Downloading: 100% - Installing yiisoft/yii2-debug (2.0.1) Downloading: 100% - Installing bower-asset/typeahead.js (v0.10.5) Downloading: 100% - Installing phpspec/php-diff (v1.0.2) Downloading: 100% - Installing yiisoft/yii2-gii (2.0.1) Downloading: 100% - Installing fzaninotto/faker (v1.4.0) Downloading: 100% - Installing yiisoft/yii2-faker (2.0.1) Downloading: 100% Writing lock file Generating autoload files chmod(‘runtime‘, 0777)...done. chmod(‘web/assets‘, 0777)...done. chmod(‘yii‘, 0755)...done.