Follow this instruction link in their documentation on how to add an existing project to github. Or even simpler, VSCode has a built in "Publish to Github" command, use it. Make sure you don't ignore anything you don't want in the .gitignore file. You don't need to upload the static build folder though, ignore it in the .gitignore file. Your friend can build the project himself.
Open the Github repository settings and look for something called "Manage access". There you can see an option where you can invite a collaborator. That way your friend will have write access to the repo and can push change to the code.
Told him to clone the repo and accept the invite -> done.
Here are the detailed steps needed to achieve this.
The existing commands can be simply run via the CLI terminal of VS-CODE. It is understood that Git is installed in the system, configured with desired username and email Id.
Navigate to the local project directory and create a local git repository:
git initOnce that is successful, click on the 'Source Control' icon on the left navbar in VS-Code.One should be able to see files ready to be commit-ed. Press on 'Commit' button, provide comments, stage the changes and commit the files. Alternatively you can run from CLI
git commit -am "Your comment"Now you need to visit your GitHub account and create a new Repository. Exclude creating 'README.md', '.gitIgnore' files. Also do not add any License to the repo. Sometimes these settings cause issue while pushing in.
Copy the link to this newly created GitHub Repository.
Come back to the terminal in VS-CODE and type these commands in succession:
git remote add origin <Link to GitHub Repo>//maps the remote repo link to local git repogit remote -v//this is to verify the link to the remote repogit push -u origin master// pushes the commit-ed changes into the remote repo
Note: If it is the first time the local git account is trying to connect to GitHub, you may be required to enter credentials to GitHub in a separate window.
- You can see the success message in the Terminal. You can also verify by refreshing the GitHub repo online.
This feature was added in 1.45, demoed here.
Launch the command palette Ctrl+Shift+P, run Publish to Github, and follow the prompt. You will be given the choice between a private and public repository, so be careful that you choose the right one.

It may ask you to login to github. It will then prompt for the repo name (defaults to the name of the folder), and for creating a .gitignore file (defaults to empty .gitignore). Just hit enter if you are fine with the defaults. When you are done it should give you a popup notification in the bottom right with a link to the repo https://github.com/<username>/<reponame>
Minor warning: if your project already has a .gitignore file in it this process will overwrite it
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.
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
Since you want to add your 2 different projects in 1 repository, you can firstly put both of your project folder inside 1 main folder, example:
MyFolder:
- MyReactProject
- MySpringbootProject
here MyFolder is your main folder, which has both of your projects, react and springboot.
then finally make a file inside MyFolder with name .gitignore, and put this line inside that file:
**/node_modules
what this file will do, is when you will push your code to github, it will ignore all the files and folders which are listed inside .gitignore file.
You Don't Need node_modules folder
when uploading your code somewhere online, you don't need to upload the node_modules folder, because this folder contains all the dependencies your project need, but when uploading your code online people can download those dependencies by calling the command npm install which will read all the modules needed from your package.json file, and download it on your machine.
To upload your code online you first have to authorize yourself on your local git program, to authorize yourself for github you can read this Article.
After authorizing yourself, firstly make a new empty github repository, by going to github or just by clicking this Link, after making a github repository open Terminal/Command Prompt in your Folder where both of your projects were, in this context my both projects were in MyFolder.
After opening Terminal/Command Prompt enter this commands:
git init
git branch -M main
git add .
git commit "Added all the files"
After running these commands, finally run these 2 final commands:
git remote add origin https://github.com/username/repository-name.git
here, replace username with your github username, and replace repository-name with the name of your repository you specified while make a new repository.
and finally run this command
git push -u origin main
and your code should be pushed on github.
If you don't want to use git commands you can also use, Github Desktop, but it is recommended you first learn basics of git and then use github desktop
There is a possibility that git is automatically initialized within your react project directory. Which means a .git folder is created, maybe that is the reason it cannot do drag and drop. This issue can be fixed by either delete the .git and again initialize using git init then you can add and commit your directory content. After that you should set the branch and add the remote repository using git remote add origin <repository-url> .
If there is any error i made or if there is any other useful method of doing so please let me know. Today is my first day in this platform and i would absolutely love to learn new things.
Thank you.