Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-pages does not recognize configured remote repo ( -o, --remote <name>) #290

Open
wzup opened this issue Apr 9, 2019 · 7 comments
Open

Comments

@wzup
Copy link

wzup commented Apr 9, 2019

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
@wzup wzup changed the title Package does not recognize configured remote repo gh-pages does not recognize configured remote repo ( -o, --remote <name>) Apr 9, 2019
@kalvinpearce
Copy link

Having same issue. Quick workaround is use --repo <url> or -r <url>

@benpryke
Copy link

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.

@joan38
Copy link

joan38 commented Feb 9, 2020

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.

@Victoire44
Copy link
Contributor

I added them to the readme here: #333

@TheTimeBandit
Copy link

Seems to be fixed, following works for me now:

gh-pages -d build -b master --remote gh-pages

@milesfrain
Copy link

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

@Manishashaw
Copy link

Having same issue. Quick workaround is use --repo <url> or -r <url>

Where to put this and when

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants