ReactFix
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • React
  • React Native
  • Programming
  • Object Oriented Programming

Sunday, November 27, 2022

[FIXED] How do I publish my react app on github properly?

 November 27, 2022     github, reactjs   

Issue

enter image <a name='more'></a>description here

I am trying to publish my react app on github.Here are the steps that I have followed.

1-I have installed git on my windows.

2- In Visual Studios terminal I have written git init

3-Then I have created a repository on github called "cartdemo"

4-In my package.json I have changed homepage, made the private false and added "deploy": "gh-pages -d build

5- Again in VS terminal I have written git add .

6-git commit -m "Go Live"

7-git remote add origin https://github.com/rahman23/cartdemo.git

8-git push

Note: Here you can see the files https://github.com/rahman23/cartdemo

However when I hit the link https://rahman23.github.io/cartdemo/ I get a page where it is written

cartdemo

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.

Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.

You will also see any lint errors in the console.

Where did I do wrong?


Solution

In step 8, you need to tell git which repo and branch to push the project to. Since you added an origin, you would...

git push origin master 

Since the project has now been pushed, add this to your package.json file. "homepage" : "http://rahman23.github.io/cartdemo" then run: yarn build in the console, and try pushing it again...



Answered By - stever
Answer Checked By - - Cary Denson (ReactFix Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Post Older Post Home

Featured Post

Is Learning React Difficult?

React is difficult to learn, no ifs and buts. React isn't inherently difficult to learn. It's a framework that's different from ...

Total Pageviews

Copyright © ReactFix