You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
#443
Open
MarkChenYutian opened this issue
Aug 28, 2022
· 2 comments
When I'm trying to deploy my react app created using create-react-app on GitHub pages, I received this error message when executing gh-pages -d build.
Attempts
I've followed the instructions in issue #192 as an attempt to fix the problem. However, non of them works (git remote add origin, changing gh-pages CLI argument, bumping gh-pages version, ...etc.)
I've checked the git remote and the remote origin exists.
(base) PS E:\c0vm-ts> npm run deploy
> c0vm-ts@0.1.0 predeploy
> npm run build
> c0vm-ts@0.1.0 build
> craco build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
388.81 kB build\static\js\main.118b6891.js
69.9 kB build\static\css\main.9f7e2885.css
The project was built assuming it is hosted at /C0VM-ts/build/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
https://cra.link/deployment
> c0vm-ts@0.1.0 deploy
> gh-pages -d build -r https://github.com/MarkChenYutian/C0VM-ts.git
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).
The text was updated successfully, but these errors were encountered:
In my case, my repo is in the external drive.
And git adds new policy after version 2.35.2 that will prevent git command executes in repo on external drive until add a exception for that directory in git config.
When deploying, gh-pages will clone a repo to node_modules/.cache/gh-pages , but running git command in that repo are blocked by the policy.
So when gh-pages try to run git config --get remote.$REMOTE.url in that cloned repo to get the remote setting will get exit code 1 from git command.
By default, gh-pages consider that remote dosen't exists and throw 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).
Workaround
add that cache repo path or * to git global config safe.directory
I was also facing the same problem. So i deleted the node_modules folder and then reinstalled all the packages by putting yarn command. If you use npm then you can use npm i to reinstall the packages.
Description
When I'm trying to deploy my react app created using
create-react-app
on GitHub pages, I received this error message when executinggh-pages -d build
.Attempts
I've followed the instructions in issue #192 as an attempt to fix the problem. However, non of them works (
git remote add origin
, changinggh-pages
CLI argument, bumpinggh-pages
version, ...etc.)git remote
and the remoteorigin
exists.gh-pages
's CLI arguments as mentioned in 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) #192 to set repo URL with-r
optionremote origin
and then add it again withBut none of these work...
Error Message
The text was updated successfully, but these errors were encountered: