3

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.

1

5 Answers 5

4

You can create a Github repository. Then copy the link to clone the repository. Next you can head towards the react project folder and open the terminal.

Run git remote add origin <url_you_copied>. After that you can do, add commit push operations.

Sign up to request clarification or add additional context in comments.

Comments

2

Run the below commands:

git init
git remote add origin <url you copied>

git init initializes a local git repo. git remote add origin <url you copied> is just what repo to push the code to.

Then, to push a commit:

git add .
git commit -m "commit message"
git push origin main

Comments

1

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

Hey Mahmood Masoud, thank you so much for the answer! I figured it out but hopefully your comment helps someone else. Appreciate the response to my super green question!
This exact answer was already provided above, wasn't it?
0

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

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.