gh-pages: Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the "repo" option)
Hello,
Just following the deployment guide from https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment
- The budget-planner app I’m building hasn’t got any changes in it. It’s a default app created by create-react-app.
- My SSH key to GitHub is working good.
- The test repository I’m trying to deploy also has set up with another deployment key that has been loaded to my ssh-agent with write access.
- Node(6.11.1) and NPM(3.10.10) has been upgraded to the latest today.
- When I run ‘npm run deploy’, I get the following error
_> budget-planner@0.1.0 deploy /Users/scott/Developer/personal/budget-planner
gh-pages -d build
Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the “repo” option)._
Also, npm-debug.log file has:
0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’,
1 verbose cli ‘/usr/local/bin/npm’,
1 verbose cli ‘run’,
1 verbose cli ‘deploy’,
1 verbose cli ‘–verbose’ ]
2 info using npm@3.10.10
3 info using node@v6.11.1
4 verbose run-script [ ‘predeploy’, ‘deploy’, ‘postdeploy’ ]
5 info lifecycle budget-planner@0.1.0~predeploy: budget-planner@0.1.0
6 verbose lifecycle budget-planner@0.1.0~predeploy: unsafe-perm in lifecycle true
7 verbose lifecycle budget-planner@0.1.0~predeploy: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/scott/Developer/personal/budget-planner/node_modules/.bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/Users/scott/bin/google_appengine:/usr/local/go/bin/:/Users/scott/Developer/go/bin:/Users/scott/Developer/android-sdk-macosx/tools:/Users/scott/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
8 verbose lifecycle budget-planner@0.1.0~predeploy: CWD: /Users/scott/Developer/personal/budget-planner
9 silly lifecycle budget-planner@0.1.0~predeploy: Args: [ ‘-c’, ‘npm run build’ ]
10 silly lifecycle budget-planner@0.1.0~predeploy: Returned: code: 0 signal: null
11 info lifecycle budget-planner@0.1.0~deploy: budget-planner@0.1.0
12 verbose lifecycle budget-planner@0.1.0~deploy: unsafe-perm in lifecycle true
13 verbose lifecycle budget-planner@0.1.0~deploy: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/scott/Developer/personal/budget-planner/node_modules/.bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/Users/scott/bin/google_appengine:/usr/local/go/bin/:/Users/scott/Developer/go/bin:/Users/scott/Developer/android-sdk-macosx/tools:/Users/scott/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
14 verbose lifecycle budget-planner@0.1.0~deploy: CWD: /Users/scott/Developer/personal/budget-planner
15 silly lifecycle budget-planner@0.1.0~deploy: Args: [ ‘-c’, ‘gh-pages -d build’ ]
16 silly lifecycle budget-planner@0.1.0~deploy: Returned: code: 1 signal: null
17 info lifecycle budget-planner@0.1.0~deploy: Failed to exec deploy script
18 verbose stack Error: budget-planner@0.1.0 deploy: gh-pages -d build
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at EventEmitter.emit (events.js:191:7)
18 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at ChildProcess.emit (events.js:191:7)
18 verbose stack at maybeClose (internal/child_process.js:891:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
19 verbose pkgid budget-planner@0.1.0
20 verbose cwd /Users/scott/Developer/personal/budget-planner
21 error Darwin 16.6.0
22 error argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “deploy” “–verbose”
23 error node v6.11.1
24 error npm v3.10.10
25 error code ELIFECYCLE
26 error budget-planner@0.1.0 deploy: gh-pages -d build
26 error Exit status 1
27 error Failed at the budget-planner@0.1.0 deploy script ‘gh-pages -d build’.
27 error Make sure you have the latest version of node.js and npm installed.
27 error If you do, this is most likely a problem with the budget-planner package,
27 error not with npm itself.
27 error Tell the author that this fails on your system:
27 error gh-pages -d build
27 error You can get information on how to open an issue for this project with:
27 error npm bugs budget-planner
27 error Or if that isn’t available, you can get their info via:
27 error npm owner ls budget-planner
27 error There is likely additional logging output above.
28 verbose exit [ 1, true ]
Any help please?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 55
Commits related to this issue
- выложил на gh-pages, можно и отдохнуть полезные ссылки https://github.com/ma1ex/react-gh-pages https://github.com/tschaub/gh-pages/issues/192 — committed to avsvistunov/15game by avsvistunov 3 years ago
I just had the same issue and was able to resolve it. Here’s what I did:
In my terminal, when I ran
git remote -v, I did not see any remote’s withe the name ‘origin’. So, I added one withgit remote add origin <url>, with the URL of my repository on Github.My other remote pointed to the same url, it just wasn’t called ‘origin’.
Then, when I ran ‘npm run deploy’ everything worked. I hope this helps, though it’s a year after you last posting.
you should add remote url for your project , then run gh-pages -d build.
Thank you so much you saved me
If u won’t to add origin repo, just change command
"deploy": "gh-pages -d build"to"deploy": "gh-pages -d build -r <repo_url>"Also to check all available flags just run
npx gh-pages --helpBruh!! This is still helping people to this day!!!
In my case the problem was solved by renaming my remote control by ‘origin’ 👍😁
I get the same error. I followed the instructions on https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#github-pages I have added “homepage”: “https://carpben.github.io/fccLeaders/” to my package.json. And I have remote set on my git (When I do push it logs “everything up to date”.
The terminal I’m using is bash on ubuntu on Windows. And it might be the issue. I used bash for this project till now. However, when I try moving to PowerShell and give the command npm run build it says it doesn’t recognise react-script. I guess it is because create-react-app installed the bash version not the windows version. Any diagnosis or possible solutions?
My origin was set up correctly, but because the repository folder was copied from another machine, deploying didn’t work. I deleted the repository and cloned it again, and the issue was fixed.
Thank you, this works for me. Really appreciate!
Same problem.
remote add origin <url>did not work for me cause there’re already origin urls ingit remote -v.Finally I changed the owner of the folder and it solved.
I have the same issue I have remote name origin and still getting this error, Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the “repo” option).
Here is my package.json file { “name”: “testapp”, “version”: “0.1.0”, “homepage”: “https://dhanur350.github.io/testapp”, “private”: true, “dependencies”: { “@testing-library/jest-dom”: “^5.16.5”, “@testing-library/react”: “^13.4.0”, “@testing-library/user-event”: “^13.5.0”, “gh-pages”: “^5.0.0”, “react”: “^18.2.0”, “react-dom”: “^18.2.0”, “react-scripts”: “5.0.1”, “web-vitals”: “^2.1.4” }, “scripts”: { “start”: “react-scripts start”, “predeploy”:“npm run build”, “deploy”: “gh-pages -d build”, “build”: “react-scripts build”, “test”: “react-scripts test”, “eject”: “react-scripts eject” }, “eslintConfig”: { “extends”: [ “react-app”, “react-app/jest” ] }, “browserslist”: { “production”: [ “>0.2%”, “not dead”, “not op_mini all” ], “development”: [ “last 1 chrome version”, “last 1 firefox version”, “last 1 safari version” ] } }
Any suggestions to fix this…??
This really worked thanks bro!!
I renamed the remote name as origin and then my problem get solved.
You are like coming from heaven Thank all of you guys my problem is solved problem =>failed to get remote.origin.url solution => git remote add origin <url> then npm run deploy
This really worked for me