gh-pages
gh-pages copied to clipboard
gh-pages does not recognize configured remote repo ( -o, --remote <name>)
I have two remote repositories in my git, origin and prod. Both exist on GitHub too:
$ git remote -v
origin [email protected]:wzup/wzup.github.repo.git (fetch)
origin [email protected]:wzup/wzup.github.repo.git (push)
prod [email protected]:wzup/wzup.github.io.git (fetch)
prod [email protected]:wzup/wzup.github.io.git (push)
I have configured gh-pages to deploy to prod repo (not to origin) as written here:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -b master -d build --remote prod" // <== Here '--remote prod'
},
Why do I get error? How to fix? This is really a bug according to documents
The default is your 'origin' remote, but this can be configured to push to any remote.
$ npm run deploy
Failed to get remote.prod.url (task must either be run in a git repository with a configured prod remote or must be configured with the "repo" option).
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `gh-pages -b master -d build --remote prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-04-debug.log
Having same issue. Quick workaround is use --repo <url> or -r <url>
I have the same issue. It's strange, because the command that gh-pages is running is simply git config --get remote.<remote name>.url, and I can execute that in the shell without issue. Perhaps the call is failing within child_process for an unexpected reason.
Hey, I came across this issue via this StackOverflow. The solution worked thanks to @kalvinpearce's super useful comment.
How are we supposed to know that those options (--repo, -b...) exists?
The documentation (README.md) doesn't even mention anything. There is only snippets of code we have no idea where to stick them in.
I added them to the readme here: https://github.com/tschaub/gh-pages/pull/333
Seems to be fixed, following works for me now:
gh-pages -d build -b master --remote gh-pages
Was having issues with this command in version 2.2.0, but can confirm this is now fixed in version 3.1.0.
gh-pages --remote tps -d dist
Having same issue. Quick workaround is use
--repo <url>or-r <url>
Where to put this and when