Can not run through composer script
whizsid opened this issue · 0 comments
whizsid commented
I have a PHP project and I am trying to deploy it's documentation using gh-pages. This my composer.json file:-
{
// Other properties
"scripts": {
// Other scripts
"gh-pages": "gh-pages --repo https://github.com/myorg/myrepo --dist doc/build --branch gh-pages"
}
}
But when I run composer run gh-pages
, I am getting this error:-
> gh-pages --repo https://github.com/myorg/myrepo --dist doc/build --branch gh-pages
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/myorg/myrepo/'
Script gh-pages --repo https://github.com/myorg/myrepo --dist doc/build --branch gh-pages handling the gh-pages event returned with error code 1
The script not asked for my credentials.
But not faced any kind of errors after I manually typed and ran the command in terminal.
Earlier I thought it was an issue of composer. But I found that composer supports tty in scripts (composer/composer#5856)
Steps to reproduce
- Download and install the composer. https://getcomposer.org/download/
- Install the gh-pages at global scope.
npm install --global gh-pages
- Create a minimum
composer.json
file in the working directory.
{
"name": "myorg/myrepo",
"description": "Description",
"type": "library",
"license": "MIT",
"minimum-stability": "dev",
"scripts": {
"gh-pages": "gh-pages --repo https://github.com/myorg/myrepo --dist doc --branch gh-pages"
}
}
- Create a basic html file in the
doc
directory.
# doc/index.html
<html>
<body>Test</body>
</html>
- Run the script.
composer run gh-pages
Environment
$ composer --version
Composer version 2.0.11 2021-02-24 14:57:23
$ gh-pages --version
3.1.0
$ uname -a
Linux archlinux 5.11.1-arch1-1 #1 SMP PREEMPT Tue, 23 Feb 2021 14:05:30 +0000 x86_64 GNU/Linux
$ php --version
PHP 8.0.2 (cli) (built: Feb 2 2021 18:26:02) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.2, Copyright (c) Zend Technologies
$ node --version
v15.10.0