Apologize up front as I am super new to React. I run the command npx create-react-app {test-app} and I understand that it creates a git repository for me. My confusion is I don't understand how I connect my github page to that repository. (if that makes sense) connect my newly created GitHub repo page connected to React project Hope this makes sense.
5 Answers
create empty repository in github account then
create react app then
open react app project in visual studio code then
open terminal in visual studio code then write
git init
git remote add origin (url your project you can see url in repository github you created first time)
git add .
git commit -m "commit message"
git push -u origin master
2 Comments
Actually you need to install GitHub application on your system; In command prompt, you need to go to the location of your React App and type '_Projectname_git init
Then open GitHub desktop application and give the path of the project to upload. Then publish it by giving name of it and commit it.
Automatically it will connected your GitHub page. You can find the added repositories.
*You must sign in to your GitHub account on desktop GitHub application before doing this process
Comments
When creating a React app using npx create-react-app <your-app-name>, it automatically initiates Git. You only need to go to the website of GitHub, create a repository with nothing inside (important because you will get conflicts otherwise), and then GitHub tells you which commands to run in your terminal.
npx create-react-app <your-app-name>
cd <your-app-name>
<go-to-git-website-and-create-repo>
git remote add origin <url-of-git-repo-you-just-created>
git branch -M main
git push -u origin main