Gwen
Gwen

Reputation: 15

Why can't I deploy my project onto Github?

I've tried to deploy my app to github but it kept showing me this in the terminal :

Cloning into 'node_modules\gh-pages.cache\gwenmengue.github.io!robofriends'...
fatal: repository 'https://gwenmengue.github.io/robofriends/' not found

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! [email protected] deploy: gh-pages -d build

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\username\AppData\Roaming\npm-cache_logs\2019-11-04T18_18_25_037Z-debug.log

I joined a screenshot of my package.json file by the way!: https://i.sstatic.net/FLTmm.jpg

Moreover when I was running the operations, I was in my project directory so I don't understand what wasn't working ?

Kindly guide me how to solve this issue. Thanks.

Upvotes: 0

Views: 690

Answers (1)

Doomd
Doomd

Reputation: 1406

First, make sure you CAN push your project to github from your project folder. Your credentials, remote repo, etc need to be setup and working before the script will work.

Just in case you need help with this, see this github help page

If you are able to push your project successfully to Github from the same project folder your terminal command is in, then try building and running your commands again:

npm run build
npm run deploy

This gh-pages article on Medium might be helpful as well. Also, if you want to change any of your gh-pages variables (so you can deploy your static code to a different repository in case that's what you're trying to do), here's the project page for gh-pages.

I, for example, am deploying ONLY my static build directory to a completely different public repository in Github, while keeping my React project source files in a different private repository. Github doesn't allow you to host pages from private repositories unless you pay, so I just use two repositories :). In order to achieve this, in script area of my package.json, I added the following options to the gh-pages command in my deploy directive:

    "deploy": "gh-pages -d build -r https://github.com/MyGitHubName/web.git -o web",

The -r option lets you enter a different repository url, and the -o option allows you to enter a different remote origin for deploying your code, in my case I named it "web" because that's the same name as my public repository on Github. You can list all of your existing remotes with:

git remote -v 

You would setup a different remote in your local git environment with:

git remote add YourNewRemoteName https://github.com/YOURGITHUBNAME/YOURPROJECTNAME

I apologize in advanced if this is all info you already know, but when I was having trouble deploying my project, I found all of this info useful. Cheers.

Upvotes: 1

Related Questions